johannes-fetz / joengine

Jo Engine is an open source 2D and 3D game engine for the Sega Saturn written in C under MIT license
http://jo-engine.org/
MIT License
205 stars 32 forks source link

Linux fixes #61

Closed abrasive closed 3 years ago

abrasive commented 3 years ago

Hello! Here are some minor fixes relevant to Linux support:

abrasive commented 3 years ago

Oh, hang on... the linker script starts with

OUTPUT_FORMAT(coff-sh)

...so what is the intended behaviour?

johannes-fetz commented 3 years ago

Coff format should not be used. So it's a mistake.It's elf :)

abrasive commented 3 years ago

Easy then, I've updated the patch accordingly :)

abrasive commented 3 years ago

My apologies - it really does need to link to coff-sh if you're using libsgl. I just spent some hours banging my head on a boot failure - it turns out that if you link directly to elf32-sh, then some of the relocations in libsgl are screwed up; for example the BlankIn and BlankOut interrupt handlers are relocated wrong at IMM_BlankIn and IMM_BlankOut, so it jumps into the middle of the handler and crashes...

However, if you link to coff-sh and then objcopy to elf32-sh, it works just fine.

The reason I'm interested in the game.elf format is because I'm adding ELF loading support to the Satiator ODE so people can boot little apps more easily, and I'd like to make things as easy for Jo users as possible. How would you feel about a patch that adds an extra objcopy step to ensure the final game.elf is actually an ELF?

johannes-fetz commented 3 years ago

I really appreciate what you do with the Satiator :) Don't hesitate to suggest a fix. I have no problem modifying the makefile or any part of the code if that makes it easier to use. The extra objcopy should solve this problem.