scarybeasts / beebjit

A very fast BBC Micro emulator.
Other
132 stars 15 forks source link

Fixes for building on Windows #27

Open richtw1 opened 3 years ago

richtw1 commented 3 years ago

Fixed a few build errors when building on mingw-w64:

For Win32 builds, beebjit will look in the executable directory for the roms. This means the roms can only be placed there now; if we want to be able to load a rom from an arbitrary file path, we would need to do this differently, and prepend the baked in filenames for the default roms with the executable path.

Edit: I redid the Win32 executable path handling. Got rid of the horrible conditional blocks in main.c and did it properly with platform-specific implementation.

scarybeasts commented 3 years ago

Thanks Rich! To keep things simpler, I replaced the strndup usage with the more cross-platform compatible combo malloc / snprintf: https://github.com/scarybeasts/beebjit/commit/cd9cf3334b860635b1e1ccee3ecd7fe563e9b806 I added the flags for the package structure warning, by copying the existing line the the Linux build files: https://github.com/scarybeasts/beebjit/commit/4fb3d245d64b1cc78e55332361f0f00e1e5c3fa2

I don't see any problems locally relating to "MinGW needed a special define" but if that's still needed for you to build, if we can isolate that change and send it along I can land it.

I'm going to take the changes to support loading files from the Windows install location, just want to ponder it a bit more.

DaveJeffery commented 3 years ago

I'm using Manjaro Linux, and I've also found a similar issue with the roms to Rich on Windows. In order to run beebjit from the console I have to do it via a shell script on my PATH which loads beebjit in its default location and passes all the parameters to it

!/bin/bash

cd "/home/kecskebak/.local/bin/beebjit-git/" ./beebjit "$@"

I can't put the beebjit folder on my path because it complains about being unable to find the os12.rom. However, with the bash script beebjit works perfectly and I'm delighted with it. It's got the only debugger I can actually make sense of!