Fix build with Microsoft Visual C++, Fix gfxhook and felica issue #48

Merged
Dniel97 merged 7 commits from GEEKiDoS/segatools:develop into develop 2024-11-11 16:28:25 +00:00
Contributor

I just wanna say that It is a SHAME that a Windows ONLY project was not able to build without MINGW
Also where's the missing 3mpxsc.h in diva hook?

This also fixes the window size issue from hook_CreateWindowExA in gfxhook
And Fixes felica issue as described in #45

I just wanna say that It is a SHAME that a Windows ONLY project was not able to build without MINGW Also where's the missing `3mpxsc.h` in diva hook? This also fixes the window size issue from hook_CreateWindowExA in gfxhook And Fixes felica issue as described in #45
GEEKiDoS added 1 commit 2024-11-09 08:34:48 +00:00
Author
Contributor

The fork of capnhook is broken too, here's the patch

diff --git a/hook/procaddr.c b/hook/procaddr.c
index 6ac1c28..2939ded 100644
--- a/hook/procaddr.c
+++ b/hook/procaddr.c
@@ -1,7 +1,7 @@
 #include <windows.h>
+#include <shlwapi.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <libgen.h>
 
 #include "hook/procaddr.h"
 
@@ -89,17 +89,16 @@ static void proc_addr_hook_init(void)
 FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
 {
     uintptr_t ordinal = (uintptr_t) name;
-    char mod_path[PATH_MAX];
-    char *mod_name;
+    char mod_path[MAX_PATH];
     const struct hook_symbol *sym;
     FARPROC result = next_GetProcAddress(hModule, name);
     
-    GetModuleFileNameA(hModule, mod_path, PATH_MAX);
-    mod_name = basename(mod_path);
+    GetModuleFileNameA(hModule, mod_path, MAX_PATH);
+    PathStripPathA(mod_path);
 
     for (int i = 0; i < proc_addr_hook_count; i++) {
 
-        if (strcmp(proc_addr_hook_list[i].name, mod_name) == 0) {
+        if (strcmp(proc_addr_hook_list[i].name, mod_path) == 0) {
             
             for (int j = 0; j < proc_addr_hook_list[i].nsyms; j++) {
                 sym = &proc_addr_hook_list[i].syms[j];
@@ -121,4 +120,4 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
     }
 
     return result;
-}
\ No newline at end of file
+}

The fork of capnhook is broken too, here's the patch ```patch diff --git a/hook/procaddr.c b/hook/procaddr.c index 6ac1c28..2939ded 100644 --- a/hook/procaddr.c +++ b/hook/procaddr.c @@ -1,7 +1,7 @@ #include <windows.h> +#include <shlwapi.h> #include <stdbool.h> #include <stdint.h> -#include <libgen.h> #include "hook/procaddr.h" @@ -89,17 +89,16 @@ static void proc_addr_hook_init(void) FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name) { uintptr_t ordinal = (uintptr_t) name; - char mod_path[PATH_MAX]; - char *mod_name; + char mod_path[MAX_PATH]; const struct hook_symbol *sym; FARPROC result = next_GetProcAddress(hModule, name); - GetModuleFileNameA(hModule, mod_path, PATH_MAX); - mod_name = basename(mod_path); + GetModuleFileNameA(hModule, mod_path, MAX_PATH); + PathStripPathA(mod_path); for (int i = 0; i < proc_addr_hook_count; i++) { - if (strcmp(proc_addr_hook_list[i].name, mod_name) == 0) { + if (strcmp(proc_addr_hook_list[i].name, mod_path) == 0) { for (int j = 0; j < proc_addr_hook_list[i].nsyms; j++) { sym = &proc_addr_hook_list[i].syms[j]; @@ -121,4 +120,4 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name) } return result; -} \ No newline at end of file +} ```
GEEKiDoS added 1 commit 2024-11-09 11:56:17 +00:00
GEEKiDoS changed title from Fix build with Microsoft Visual C++ to Fix build with Microsoft Visual C++, Fix gfxhook and felica issue 2024-11-09 11:58:35 +00:00
GEEKiDoS added 1 commit 2024-11-09 12:01:24 +00:00
GEEKiDoS added 1 commit 2024-11-09 14:22:31 +00:00
Author
Contributor

Added zip command for msvc-build.bat, now you can make a release with msvc-build.bat build && msvc-build.bat zip.
Zip script was parsed from Package.mk with a crappy but working package.ps1

Added zip command for msvc-build.bat, now you can make a release with `msvc-build.bat build && msvc-build.bat zip`. Zip script was parsed from Package.mk with a crappy but working package.ps1
GEEKiDoS added 1 commit 2024-11-09 16:20:38 +00:00
First-time contributor

I've implemented your procaddr fix to capnhook, commit hash b595e4bf8a274ba3bdaf583e13a7ebc7efe0f48f. Thank you for contributing!

b595e4bf8a

I've implemented your procaddr fix to capnhook, commit hash b595e4bf8a274ba3bdaf583e13a7ebc7efe0f48f. Thank you for contributing! https://github.com/Hay1tsme/capnhook/commit/b595e4bf8a274ba3bdaf583e13a7ebc7efe0f48f
Dniel97 requested changes 2024-11-10 21:05:07 +00:00
Dismissed
@ -188,0 +278,4 @@
goto fail;
}
hr = iobuf_write_be64(res, 0x0078000000000000ull);
Owner

What is that magic number?

What is that magic number?
Author
Contributor

from actual card, but 0 should works too

from actual card, but 0 should works too
Author
Contributor

This only implments the read command to 0x82 block, And aimelib reads IDm from it instead of the value in polling one

note: It is not possible to to fully emulate an AIC card due to MAC_A stuff.
reference: https://tqlwsl.moe/index.php/archives/2815/

This only implments the read command to 0x82 block, And aimelib reads IDm from it instead of the value in polling one note: It is not possible to to fully emulate an AIC card due to MAC_A stuff. reference: https://tqlwsl.moe/index.php/archives/2815/
GEEKiDoS marked this conversation as resolved
msvc-build.bat Outdated
@ -0,0 +7,4 @@
set DOC_DIR=doc
REM Set Your Visual Studio install path if this one was wrong
set VS_INSTALLATION=C:\Program Files\Microsoft Visual Studio\2022\Community
Owner

Could you automatically fetch the installation path? Or try the installation paths for VS 2016, 2019, 2022? This would greatly improve compatibility!

Could you automatically fetch the installation path? Or try the installation paths for VS 2016, 2019, 2022? This would greatly improve compatibility!
Author
Contributor

I tried but theres actually no way without manually scanning Visual Studio Install path, the vsvarsall.bat from %VS140COMMONTOOL% one does not works actually

I tried but theres actually no way without manually scanning Visual Studio Install path, the vsvarsall.bat from %VS140COMMONTOOL% one does not works actually
Owner

I see, could you then scan the VS 2022 directory first and then 2019 and 2016 afterwards?

I see, could you then scan the VS 2022 directory first and then 2019 and 2016 afterwards?
Author
Contributor

Ok I found a way from vs developer community, it should works for VS2017/VS2019/VS2022, let me try that

Ok I found a way from vs developer community, it should works for VS2017/VS2019/VS2022, let me try that
Author
Contributor

Done, It should now works with VS2010+(Microsoft Documentation) if Visual Studio Installer is installed, Which most people do

Done, It should now works with VS2010+([Microsoft Documentation](https://learn.microsoft.com/en-us/visualstudio/extensibility/locating-visual-studio?view=vs-2022#tools)) if Visual Studio Installer is installed, Which most people do
GEEKiDoS marked this conversation as resolved
@ -0,0 +19,4 @@
[System.Collections.ArrayList]$files = @();
$folder = Get-Location
cat .\Package.mk | % {
Owner

WOW thats overkill but I love it!

WOW thats overkill but I love it!
GEEKiDoS marked this conversation as resolved
Owner

Could you also increase the capnhook commit in subprojects/capnhook.wrap?

Could you also increase the capnhook commit in [subprojects/capnhook.wrap](https://gitea.tendokyu.moe/Dniel97/segatools/src/branch/develop/subprojects/capnhook.wrap)?
Owner

I just wanna say that It is a SHAME that a Windows ONLY project was not able to build without MINGW

Yeah thats true, docker just worked and i didn't bother with msvc.

Also where's the missing 3mpxsc.h in diva hook?

That was just a test and should not have been committed in the first place.

This also fixes the window size issue from hook_CreateWindowExA in gfxhook

Thanks, that was an oversight.

And Fixes felica issue as described in #45

Thank you very much for taking your time and fixing it!

> I just wanna say that It is a SHAME that a Windows ONLY project was not able to build without MINGW Yeah thats true, docker just worked and i didn't bother with msvc. > Also where's the missing `3mpxsc.h` in diva hook? That was just a test and should not have been committed in the first place. > This also fixes the window size issue from hook_CreateWindowExA in gfxhook Thanks, that was an oversight. > And Fixes felica issue as described in #45 Thank you very much for taking your time and fixing it!
GEEKiDoS added 1 commit 2024-11-11 07:23:26 +00:00
GEEKiDoS added 1 commit 2024-11-11 07:31:23 +00:00
GEEKiDoS requested review from Dniel97 2024-11-11 16:00:39 +00:00
Dniel97 approved these changes 2024-11-11 16:27:56 +00:00
Owner

Yup that looks perfect, merging!

Yup that looks perfect, merging!
Dniel97 merged commit c80f903cf8 into develop 2024-11-11 16:28:25 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Dniel97/segatools#48
No description provided.