Patches for linux

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

Patches for linux

Postby AmatCoder » Mon 10 Apr, 2017 6:31 pm

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 23 times
AmatCoder
Posts: 28
Joined: Thu 02 Mar, 2017 8:45 pm

Re: Patches for linux

Postby AmatCoder » Mon 10 Apr, 2017 6:55 pm

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 18 times
AmatCoder
Posts: 28
Joined: Thu 02 Mar, 2017 8:45 pm

Re: Patches for linux

Postby AmatCoder » Mon 10 Apr, 2017 7:15 pm

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 19 times
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: Patches for linux

Postby bit » Mon 10 Apr, 2017 7:39 pm

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 23 times
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: Patches for linux

Postby bit » Mon 10 Apr, 2017 7:45 pm

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

Re: Patches for linux

Postby tomaszkam » Tue 11 Apr, 2017 9:37 pm

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 17 times
A. Naim
Posts: 75
Joined: Thu 09 Jul, 2015 5:06 pm

Re: Patches for linux

Postby A. Naim » Tue 11 Apr, 2017 11:51 pm

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

Postby tomaszkam » Wed 12 Apr, 2017 5:12 am

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

Postby bit » Wed 12 Apr, 2017 6:44 am

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

Postby tomaszkam » Wed 12 Apr, 2017 7:36 pm

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: 75
Joined: Thu 09 Jul, 2015 5:06 pm

Re: Patches for linux

Postby A. Naim » Thu 13 Apr, 2017 4:47 pm

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 ;)
SarahWalker
Site Admin
Posts: 1327
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Patches for linux

Postby SarahWalker » Wed 19 Apr, 2017 3:38 pm

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: 88
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: Patches for linux

Postby Greatpsycho » Fri 12 May, 2017 6:54 am

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 13 times

Return to “Development”

Who is online

Users browsing this forum: No registered users and 1 guest