Skip to content
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

Fixes for building on Windows #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fixes for building on Windows #27

wants to merge 4 commits into from

Conversation

richtw1
Copy link

@richtw1 richtw1 commented Jan 30, 2021

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

  • strndup() is not part of the standard library and needed to be reimplemented locally
  • the state save/load generates warnings with the packed struct. Struct packing is also not standard C - the struct should probably be left 'natural' and save/load to disk written so that the data is packed. I couldn't be bothered, and just turned off errors for the warning in question, so this is $TODO!
  • MinGW needed a special define so that printf formatters worked without warning. This is MinGW weirdness I think.

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.

Created os_file_<platform>.c for functionality which is OS dependent. Removed previous conditional blocks.
@scarybeasts
Copy link
Owner

Thanks Rich!
To keep things simpler, I replaced the strndup usage with the more cross-platform compatible combo malloc / snprintf: cd9cf33
I added the flags for the package structure warning, by copying the existing line the the Linux build files: 4fb3d24

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants