91 Commits

Author SHA1 Message Date
Dávid Balatoni
8bd112f0e4
Add GetTempFileNameA (#84) 2025-06-18 00:12:39 +02:00
Ethan Roseman
5343bc70d9
Update CI step versions 2025-06-14 13:32:35 +09:00
Howard Luck
c01d9a25b9
findNextFile improvement (#82)
* move empty pattern check into while loop

* early return if pattern is empty

* comment
2025-06-01 22:22:17 +09:00
Pheenoh
93862405ed
move empty pattern check into while loop (#81) 0.6.16 2024-08-19 21:00:15 -06:00
Exant64
bcc6eae470
Added quotation mark check in files::pathFromWindows (#77)
* Added quotation mark check in files::pathFromWindows

* Moved quotation mark logic to createprocess argument processing code
0.6.15
2024-07-23 00:29:47 -06:00
Parker
701134e596
fix (#80) 2024-07-23 00:27:03 -06:00
Anghelo Carvajal
ca9364a0df
Add trailing periods support to FindFirstFileA (#75)
* idk

* meh

* Implement trailing periods on FindFirstFileA

* ah?

* Remove assert
0.6.14
2024-05-27 19:51:24 -06:00
Anghelo Carvajal
396008c593
Proper implementation for GetSystemTime and GetLocalTime (#73)
* Implement

* GetLocalTime
2024-03-23 10:56:34 -06:00
Anghelo Carvajal
0fbe87751f
Fix FindFirstFileA failing due to an empty parent and add locale LCType stubs (#71)
* Fix sn cpp.exe not finding the include paths

* str_for_LCType stubs for sn gcc as.exe
0.6.13
2024-03-22 22:44:53 -06:00
Mark Street
6d284d4461
Update link to gc/wii compilers (#72) 2024-03-22 22:30:18 +00:00
Mark Street
d71a902ace
Add GetTempPathA (#68)
* Add GetTempPathA

* Update dll/kernel32.cpp

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>

---------

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
0.6.12
2024-02-10 22:09:28 +00:00
limb
a1b929a413
Fixed grammatical error in README.md (#67)
less dependencies -> fewer dependencies
2024-01-10 22:59:53 +09:00
ConorB
a85e589de5
[TEMPORARY FIX] Fix issues with the stack not being resized correctly (#65) 0.6.11 2023-12-23 15:34:37 -07:00
Mark Street
ae5b4fffaa
Add EnumSystemLocalesA stub (#63) 0.6.10 2023-11-26 20:04:27 +00:00
nocato
c6fa592a31
Handle dwCreationDisposition in CreateFileA to fix PSYLINK (#60)
Before this change, dwCreationDisposition parameter of CreateFileA was
ignored by wibo. However, it turns out that PSYLINK.EXE in PsyQ 4.4
sometimes depends on correct handling of that parameter.

When building overlays with PSYLINK.EXE, it sometimes opens the
resulting overlay file the second time, with OPEN_EXISTING creation
disposition (as opposed to TRUNCATE_EXISTING). Before the change,
wibo opened that file with fopen(..., "wb+") which truncated the file
even though OPEN_EXISTING (non-truncating) was requested. This affected
https://github.com/foxdieteam/mgs_reversing, where one of the overlays
(camera.bin) was built incorrectly when using wibo (worked correctly
on Windows or with wine).

This commit adds proper handling of dwCreationDisposition parameter.
The file now can be opened in truncating or non-truncating mode.
Additionally, the implementation now reacts correctly to file
existing/non-existing as specified by the requested creation disposition
mode. For example, if CreateFileA is called with OPEN_EXISTING and the
file does not exist it will set an error and not create a new file
(the previous behavior). If the file exists, it's opened in
non-truncating mode, as TRUNCATE_EXISTING or CREATE_ALWAYS is required
for truncation.

After the fix you can correctly build the whole mgs_reversing project
with wibo - tools running under wibo: ASMPSX, ASPSX, CC1PSX 4.0 & 4.4,
PSYLINK. I have NOT tested other executables apart from those.
0.6.9
2023-10-27 16:18:06 +09:00
Mark Street
2d627de537
Fix segfault in CoCreateInstance (#59)
* Fix segfault in CoCreateInstance

* update comment

* typo

* typo x2
0.6.8
2023-10-25 22:06:49 +01:00
Mark Street
0f8fb7f62d
Support ProDC NgcAs.exe (#57) 0.6.7 2023-10-22 09:11:00 +01:00
Mark Street
30ef434872
Add Fibre local storage (Fls*) functions for armcc (#55)
* Add Fibre local storage (Fls*) functions for armcc

* Update dll/kernel32.cpp

Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>

* Update dll/kernel32.cpp

Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>

* Update dll/kernel32.cpp

Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>

* Update dll/kernel32.cpp

Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>

* one more copypasta

---------

Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
0.6.6
2023-10-17 21:33:22 +01:00
EstexNT
a829d0d58b
Fix a use-after-free in CreateProcessA (#54)
Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
0.6.5
2023-10-17 19:39:28 +01:00
Simon Lindholm
90101d8bc1 Minor cppcheck lint fixes 2023-10-16 20:08:52 +02:00
Simon Lindholm
4bf81a9ec9 Fix ineffective "x < 0" comparisons in CompareString
Pointed out by cppcheck.
2023-10-16 20:08:52 +02:00
Simon Lindholm
b1dd93d7b7 Zero out TIB
Not for any particular reason, but having it contain non-deterministic
stack garbage seems like a bad idea.
2023-10-16 20:05:34 +02:00
Ethan Roseman
32887d2439
Add retrowin32 to related projects in README 2023-10-15 07:41:40 -04:00
c9d634876d
Handle special handle value from FindFirstFileA in FindNextFileA (#52) 0.6.4 2023-10-08 13:08:53 -04:00
97a5af2055
Build a wibo_debug binary as well (#51) 2023-10-08 12:46:26 -04:00
5a4af7d51b
Ensure we don't reallocate during 2GB address space block (#49)
* Ensure we don't reallocate during 2GB address space block

* Use std::string_view and std::from_chars to avoid allocations

* Use MAP_FIXED instead of MAP_FIXED_NOREPLACE

* Use raw syscalls and stack buffer

* Use exit(1)
0.6.3
2023-10-03 21:26:30 -04:00
c4de05946d
Fix TlsGetValue & more (#48)
`TlsGetValue` disambiguates 0 and an error by relying on `GetLastError`. Depending on the program state, `GetLastError` could be non-0, even though `TlsGetValue` succeeded. Resolve this by always setting `wibo::lastError`. This matches the behavior described by the documentation.

Additionally, when reading resources, later versions of mwcc and mwld call `GetModuleHandleA` with the program path, and then call `LoadStringA` on that handle. Support this behavior by _actually_ loading the PE at the path passed in to `GetModuleHandleA`, instead of assuming it's the current program.

(This is especially useful because sjiswrap relies on overriding `GetModuleFileNameA`, so the wrapped program reads its own resources, rather than sjiswrap's.)

Other small changes:
- Add ms-win-crt `exit` & run atexit funcs
- Implements vcruntime `memmove`
- Implements kernel32 `GetModuleFileNameA`
0.6.2
2023-10-01 23:56:35 -04:00
Ethan Roseman
8a6aacb82d
GetLocaleInfoW (#47)
* GetLocaleInfoW for ee-as.exe 991111b

* Try to do it the right way

* 3rd time's the charm?

* round 4

* it doesn't matter now what happens i will never give up the fight

* comments

* fin
0.6.1
2023-09-22 09:13:56 +09:00
ConorB
218b4d7d76
Implement enough process handling logic to make psyq4.0 happy (#46)
* Implement enough process handling logic to make psyq4.0 happy

* revert gitignore

* data type update

* PR review

* DEBUG_LOG mistake

---------

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
0.6.0
2023-09-18 15:05:47 +09:00
Mark Street
ceb13b34de
Use correct token for docker deployment (#45)
* Use correct token for docker deployment

* Update link to gc_wii compilers

* Update deps in ci.yml too
0.5.2
2023-09-14 15:12:28 +01:00
Ethan Roseman
6a420668e5
CorExitProcess for armcc_41_1440 (#44)
* Implement CorExitProcess for armcc_41_1440

* Fix function signature, add dll coverage
2023-09-12 22:44:56 +09:00
d27fc944bd
Fix GetFullPathNameW, GetEnvironmentVariableW (#43) 0.5.1 2023-09-11 18:36:13 +09:00
Ethan Roseman
b7e8e5fb80
3 msvcrt funcs (#42)
* msvcrt funcs

* fix empty final line

* Promment
2023-09-11 04:22:01 +09:00
Anghelo Carvajal
a5499f27de
Fix SetFilePointerEx to return FALSE instead of INVALID_SET_FILE_POINTER (#41) 2023-09-10 21:54:25 +09:00
Ethan Roseman
8ab683e5c6
WiBo -> wibo 2023-09-10 13:14:45 +09:00
94b44fd697
Everything needed to run simple Rust programs (#40)
* Everything needed to run simple Rust programs

* Add IsDBCSLeadByte implementation

* Address PR comments
0.5.0
2023-09-10 12:07:23 +09:00
ConorB
6e18120410
Add armcc support (#39)
* armcc 5.04, ignore seh longjmps

* Update CI link

* Stub RtlUnwind entirely

---------

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
2023-09-08 08:17:35 +09:00
ConorB
3e2d84fa69
Force VirtualAlloc allocations to fall below the 2GB mark (#36)
Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
0.4.2
2023-06-02 21:30:45 +02:00
Parker
e83af50b10
Properly implement GetCurrentProcessID, GetCurrentThreadId (#35) 2023-04-01 11:13:21 +02:00
7d08a2bdca
Various fixes for mwcc/mwld (#32)
* Override GetFileAttributesA for MWCC license.dat

* Add WIN_FUNC to FileTimeToLocalFileTime

* Use callee_pop_aggregate_return(0)

* Lexically normalize paths
0.4.1
2023-01-23 21:22:50 +01:00
6b6a462ea1
Use __attribute__((force_align_arg_pointer)) (#30) 2023-01-23 16:36:14 +01:00
9837ce0bf4
Pass absolute path to exe in argv[0] (#31) 2023-01-23 16:35:50 +01:00
67f99ba1b2
Build static binary (#29) v0.4.0 2023-01-23 10:20:30 +09:00
jdflyer
aec6f0dbe9
Implement GetShortPathNameA (#28) 2022-12-30 01:37:21 +01:00
Ryan Burns
635de4fa93
Handle GetCurrentDirectory required buffer size return value (#27)
When the output buffer size is too small, GetCurrentDirectory does
nothing and simply returns the larger required size.

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory#return-value

Needed to run Code Warrior 4 mwcc.exe with no arguments, displaying usage/help message.

(Still unable to compile/preprocess with CW4 mwcc.exe)
2022-12-02 10:46:38 +01:00
Ethan Roseman
681137902b
don't try to mmap 0-sized things (#26) 0.3.0 2022-09-25 02:03:40 +09:00
Ethan Roseman
b65a585ee3
Move docker build back a bit (#25) 2022-09-25 02:02:49 +09:00
Ethan Roseman
d631bad6b2
Build it on focal (#24)
* Build it on bionic

* no sudo

* cmake

* don't use ninja

* try focal

* model after #15

* Whoops

* lower minimum CMakeLists

* focal

* Fix

* debug yaml

* whut

* now?
0.2.6
2022-09-25 01:04:29 +09:00
Ethan Roseman
6de4e9a163
3 funcs needed for some mwcc compilers (#22)
* 3 funcs needed for some mwcc compilers

* some PR feedback

* lots more via pair programming with Simon

* cleanup, add test dir as an include dir for tests

* bugfix
0.2.5
2022-09-24 23:59:30 +09:00
Simon Lindholm
ffe30a626b Fix cmdline backslash escaping 0.2.4 2022-07-31 13:17:14 +02:00