Patches for linux

Discussion of development and patch submission.
Post Reply
AmatCoder
Posts: 28
Joined: Thu 02 Mar, 2017 8:45 pm

Patches for linux

Post by AmatCoder »

I will use this thread to upload patches (mainly for linux).

This first one updates makefiles to avoid undefined references.
Attachments
update_makefiles.patch
(31.13 KiB) Downloaded 353 times
AmatCoder
Posts: 28
Joined: Thu 02 Mar, 2017 8:45 pm

Re: Patches for linux

Post by AmatCoder »

This patch add static specifier to inline functions in 808x.c file.
It fixes undefined references if compiled with --enable-debug option.
Attachments
static_inline.patch
(715 Bytes) Downloaded 316 times
AmatCoder
Posts: 28
Joined: Thu 02 Mar, 2017 8:45 pm

Re: Patches for linux

Post by AmatCoder »

This one fixes a segmentation fault produced when user select a machine with internal ide hdd into allegro gui.

Rationale: internal_name is a pointer and is uninitialized when copying with strcpy. I think it is better to use a literal.
Attachments
segfault_ide.patch
(492 Bytes) Downloaded 320 times
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: Patches for linux

Post by bit »

I hope it's alright that I'm borrowing your thread to post two patches related to Linux :)

The first one is a small patch that fixes issues I experienced with the 32-bit Voodoo recompiler.
Attachments
voodoo_codegen_linux32.patch
(568 Bytes) Downloaded 328 times
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: Patches for linux

Post by bit »

This patch modifies romfopen and rom_present to be case-insensitive on Linux.
Attachments
case_insensitive_romfopen_linux.patch
(1.82 KiB) Downloaded 322 times
tomaszkam
Posts: 3
Joined: Tue 11 Apr, 2017 7:15 pm

Re: Patches for linux

Post by tomaszkam »

For the case sensitive names, wouldn't it be better to just select a consistent spelling approach for the rom files? For example making all of the lower case. This will not require scanning a dir (which may be a long time if number of roms increase) and will not affect Windows builds in any way.

Attached patch that changes all roms and nvrs references to lowercase only.
Attachments
only_lower_case_roms.patch
(12.2 KiB) Downloaded 319 times
A. Naim
Posts: 139
Joined: Thu 09 Jul, 2015 5:06 pm

Re: Patches for linux

Post by A. Naim »

Even with a HDD, a thousand items per second is not out of line. I don't think scanning the rom dir is going to be a problem. :)

How to check: If you have a HDD, check the properties. It'll start counting files and stored data (Linux Mint and Windows). Mine peaked at ~1000 files/second in the first few seconds.
tomaszkam
Posts: 3
Joined: Tue 11 Apr, 2017 7:15 pm

Re: Patches for linux

Post by tomaszkam »

Secondly, proposed patch only ignores case sensitivity for the files, not whole dirs (and we have dirs inside roms directory). Using consistent naming also address that situation and it's a lot simpler.
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: Patches for linux

Post by bit »

You have a point tomaszkam. My first thought was also to just convert the subpath to lowercase inside romfopen, but when I later realized that the end-user have to change every non-lowercase file either manually or by finding/writing a script it did not feel very user-friendly and I thought of this solution instead. And as A. Naim said scanning the directory shouldn't be an issue.
Regarding the subdirectories inside the roms-directory they are both premade and lowercase so that will probably not be a problem either.

But as a long-time Linux-user I would like to go all lowercase, since I like it that way :) However this approach just felt like it would be the most user-friendly.

EDIT:
How about using both solutions?
1. Try the file with its default filename (I actually think this would be true in most cases, but could probably be skipped on Linux).
2. If running Linux and the file does not exist, try it with all lowercase (this would be the preferred way for Linux).
3. If it still does not exist, do a directory scan.

Doing it this way would make it work in most likely all cases, but if anyone do have problems with for example subdirectories being non-lowercase they could just rename everything and it should work without having to do a directory scan.

EDIT 2:
Also, it should be no problem to add so it also searches subdirectories case-insensitive if that really might be an issue.
tomaszkam
Posts: 3
Joined: Tue 11 Apr, 2017 7:15 pm

Re: Patches for linux

Post by tomaszkam »

I think that the problems we currently encounter is caused by random use of lower/upper case letters for the rom names. Moreover the casing was different between the docs and actual code, so matching readme will not help.
And I think, once it would be clear that all files and dirs need to use lower case, then no workaround would be needed at all, as user will just rename their roms.

I consider any attempt to implement behaviour that mimics case-insesitive filesystem on case-sensitive one as over-engineering. And less platform depended code, the better.
A. Naim
Posts: 139
Joined: Thu 09 Jul, 2015 5:06 pm

Re: Patches for linux

Post by A. Naim »

tomaszkam wrote:I think that the problems we currently encounter is caused by random use of lower/upper case letters for the rom names. Moreover the casing was different between the docs and actual code, so matching readme will not help.
And I think, once it would be clear that all files and dirs need to use lower case, then no workaround would be needed at all, as user will just rename their roms.

I consider any attempt to implement behaviour that mimics case-insesitive filesystem on case-sensitive one as over-engineering. And less platform depended code, the better.
I'm of the opinion that case-sensitivity in general is not a great idea. I mean, your reasoning there is probably right, but *puts in Internet Pedant Hat and travels back to 1980-something*. ;)

Although I don't know if this holds true for all languages, for English (and Latin/Greek/Germanic derived languages in general) the idea that there's a difference between "MyTextFile.txt", "myTextFile.txt" or "mytextfile.txt" doesn't seem to make sense, to me, linguistically.

Overall, it adds to the "remembered data load", and a bit to the "vocal communication load", and doesn't really add anything useful enough, IMO. A better option would be to rename the files; ex. "My Accounting File.txt", "My Journal File.txt", or "Random Notes File @ $Name_Of_Tech_Conference.txt".

...And yeah, I'm as prone to "New Document.txt #" for random notes as anyone else. So don't take this too seriously. :) I mean, if you're writing a new OS, it might be useful, but otherwise, it's just the random musings of some random person on the internet on something that's not going to be changed at this point. :) I don't take it too seriously, either.

Although if I ever do make an OS or programming language, it'll probably be case-insensitive. :p ;)
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patches for linux

Post by SarahWalker »

Committed all these patches as of rev 692. I've changed the ROM file names to lower case rather than try to handle all cases - it just seems neater!
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: Patches for linux

Post by Greatpsycho »

This patch solves compile error on linux after Dell System 200 patch. Rewritten against commit 99908fe.
Attachments
Makefile.in.patch
Patch against commit 99908fe.
(4.51 KiB) Downloaded 308 times
Post Reply