New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make game runnable on posix #14
Conversation
@@ -12,6 +12,7 @@ | |||
|
|||
int main(int argc, const char * * argv) | |||
{ | |||
openloco::lpCmdLine((char *)argv[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lpCmdLine
is actually the full command line given to the application. You would need to join argv together with space separated, quotes if necessary. Or just leave it unset and implement the parser wherever it is.
5fdefad
to
80d3823
Compare
fce030f
to
0f000a1
Compare
FWIW, in its current state, I can get the PR to compile on Arch Linux, but running it immediately leads to a segfault:
|
Seems to be an issue with |
0f000a1
to
2f466e5
Compare
Required me to change casing of files from what GOG provides, but it works just fine. Here's what the filenames should be:
|
Confirmed working with the data files matching case. These really ought to be case-insensitive, but for now… 👍 |
When I try to build this branch, I get: |
@Gymnasiast Ubuntu's GCC has |
@janisozaur I believe that Marijn changed this in this branch, this line was fine before. |
clang suggests |
But ideally you should be using |
134839a
to
3e8ff06
Compare
e82f920
to
328db4b
Compare
write_jmp(0x4078be, (void*)&fn_4078be); | ||
write_jmp(0x4078f8, (void*)&fn_timeGetTime); | ||
// write_jmp(0x4078f8, (void*)&fn_timeGetTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove these alltogether?
src/openloco/interop/hook.cpp
Outdated
static void* _smallHooks; | ||
static uint8_t* _offset; | ||
|
||
static void* makeJump(uint32_t address, void* fn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make_jump
How does this differ from write_jmp
, should it just replace it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pushes the address onto the stack, before calling the function. It's used to hook all the library functions. The offset is then pointed to the new operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we always use this instead of write_jmp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. It would need to generate different assembly based on whether cdecl
or stdcall
is used. write_jmp
currently is used for both types. This is only used for 'If lib function is used that we haven't tackled, print the address to the command line'.
src/openloco/interop/hooks.cpp
Outdated
@@ -1,11 +1,16 @@ | |||
#include <assert.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <cassert>
GOG version ships file named g1.DAT
2e4d092
to
13b11cf
Compare
@@ -357,7 +361,7 @@ namespace openloco::interop | |||
if (left != right) | |||
{ | |||
uint32_t addr = lhs.begin + i; | |||
std::printf("0x%06X: %02hhX %02hhX\n", addr, std::to_integer<unsigned char>(left), std::to_integer<unsigned char>(right)); | |||
std::printf("0x%06X: %02X %02X\n", addr, (uint8_t)left, (uint8_t)right); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh well…
Keyboard shortcut handling
No description provided.