XboxDev / nxdk

The cross-platform, open-source SDK to develop for original Xbox: *new* xdk
437 stars 66 forks source link

Implement `direct.h` functions #636

Open ExoSkye opened 1 year ago

ExoSkye commented 1 year ago

fnmerge and fnsplit haven't been implemented since I noticed inconsistencies in the documentation relating to them, for now I simply have empty function definitions in the form described by https://www.digitalmars.com/rtl/direct.html (ie no _ prefix)

The status of other functions is as follows: _chdir, _chdrive: impossible to implement, succeeds without an error code, or change of state in the Xbox _getcwd, _getwd: impossible to implement, return NULL pointers and sets errno to -EINVAL _getdrive: as before, impossible to implement - returns 0 and sets errno to -EINVAL (this is the error state described by a combo of MS public documentation and digital mars docs) _searchpath: impossible to implement since there is no PATH variable on the Xbox _mkdir, _rmdir: implemented, testing required, however

MAXPATH, MAXDRIVE defined, however these may be incorrect right now (they were taken from DOS-era documentation)

Should fix #466 when complete

ExoSkye commented 1 year ago

I've since been informed that getcwd and getwd should be possible to implement by Andy - so I'll implement those when I get home

ExoSkye commented 1 year ago

I'm going to set this as ready to review since I believe, other than certain stubbed functions, this is ready to go

ExoSkye commented 1 year ago

I say this, and then completely forget to actually add the .c file to the makefile, whoops, i'll fix that rq

ExoSkye commented 1 year ago

Can confirm that this built locally with no hiccups

ExoSkye commented 1 year ago

Ok, I've implemented a Win32 error code to errno function which just uses a switch statement (I felt that that would be easier for a compiler to optimise, there's even a chance that given there's no IO in it, it could optimise it away completely)