Commit Graph

68 Commits

Author SHA1 Message Date
Luke Street c9d634876d
Handle special handle value from FindFirstFileA in FindNextFileA (#52) 2023-10-08 13:08:53 -04:00
Luke Street 97a5af2055
Build a wibo_debug binary as well (#51) 2023-10-08 12:46:26 -04:00
Luke Street 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)
2023-10-03 21:26:30 -04:00
Luke Street 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`
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
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>
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
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
Luke Street d27fc944bd
Fix `GetFullPathNameW`, `GetEnvironmentVariableW` (#43) 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
Luke Street 94b44fd697
Everything needed to run simple Rust programs (#40)
* Everything needed to run simple Rust programs

* Add IsDBCSLeadByte implementation

* Address PR comments
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>
2023-06-02 21:30:45 +02:00
Parker e83af50b10
Properly implement GetCurrentProcessID, GetCurrentThreadId (#35) 2023-04-01 11:13:21 +02:00
Luke Street 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
2023-01-23 21:22:50 +01:00
Luke Street 6b6a462ea1
Use __attribute__((force_align_arg_pointer)) (#30) 2023-01-23 16:36:14 +01:00
Luke Street 9837ce0bf4
Pass absolute path to exe in argv[0] (#31) 2023-01-23 16:35:50 +01:00
Luke Street 67f99ba1b2
Build static binary (#29) 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) 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?
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
2022-09-24 23:59:30 +09:00
Simon Lindholm ffe30a626b Fix cmdline backslash escaping 2022-07-31 13:17:14 +02:00
Simon Lindholm e54657b55f Misc minor improvements 2022-07-29 23:39:42 +02:00
Simon Lindholm 93b99a4f24 Handle some more armcc versions 2022-07-29 17:44:27 +02:00
Mark Street bd4c09e743
Add naive VirtualFree (#20) 2022-07-28 00:23:45 +02:00
Simon Lindholm c47665f8ae Improve TIB 2022-07-28 00:13:36 +02:00
Simon Lindholm 747f1895ef More logging 2022-07-27 23:04:26 +02:00
Simon Lindholm 42f2e6935e MessageBoxA 2022-07-27 21:27:27 +01:00
Simon Lindholm ff947fb707 Fix Heap{Re,}Alloc 2022-07-27 21:27:27 +01:00
Mark Street fa6c98406e A handful more functions to get cpe2exe to start 2022-07-27 21:27:27 +01:00
Simon Lindholm ced712df09 Clean up function resolution a little 2022-07-18 23:02:55 +02:00
Mark Street 11bdc5e8a2
move dlls into dll/ dir (#16) 2022-07-18 09:54:17 -04:00
Ryan Burns b86a542fe2
Explicitly link std::filesystem as needed (#14)
* Fix cmake install command

PROGRAMS specifies executable files, while TARGETS specifies cmake
targets. This install command happened to work when doing an in-tree
build (build dir == source dir) but will otherwise fail.

* Explicitly link std::filesystem as needed

On some older compilers, std::filesystem is provided as a separate
library from the C++ standard library. For example, on GCC 8, one must
explicitly link with -lstdc++fs.

We can use a drop-in https://github.com/vector-of-bool/CMakeCM module to
automate detection of and linking against this auxiliary library when needed.

* Add missing include

std::min is in <algorithm> header
This is transitively included in libstdc++ (GCC)
but not in libc++ (Clang)

(Encountered when testing -lc++fs auxiliary library linking in Clang 7)
2022-07-08 02:02:27 +09:00
Mark Street e997178c57
Fix double ghcr.io in docker tag (#13) 2022-07-07 03:51:32 +09:00
Ethan Roseman fae4219d7f
Revert "Add -lstdc++fs to cmake for older GCC (#11)" (#12)
This reverts commit 583769d7c8.
2022-07-07 03:26:16 +09:00
BR- 583769d7c8
Add -lstdc++fs to cmake for older GCC (#11) 2022-07-07 03:21:18 +09:00
Luke Street 4ae7bba638
Add CMakeLists.txt (#8)
* Add CMakeLists.txt

* Use CMake in CI

* Remove Makefile & update README.md
2022-07-06 20:03:19 +09:00
camthesaxman 97c946fd86
implement SetEndOfFile, CreateDirectoryA, RemoveDirectoryA, SetFileAttributesA (#6)
* implement SetEndOfFile, CreateDirectoryA, RemoveDirectoryA, SetFileAttributesA

* call fflush before ftruncate
2022-07-06 11:26:24 +09:00
Luke Street a8b9452f33
kernel32: Use fstat in GetFileSize (#10)
Improves mwldeppc performance significantly.

Before:
real    0m30.322s
user    0m7.800s
sys     0m22.495s

After:
real	0m16.679s
user	0m4.693s
sys	    0m11.965s

Wine (for comparison):
real    0m24.625s
user    0m0.048s
sys     0m0.034s
2022-07-06 00:13:20 +02:00
Luke Street 07af846d1c files: Use drive letter Z: for root FS (matches wine) 2022-07-04 21:38:21 +02:00
Luke Street d29a78e862 Makefile: Target C++17 instead of C++2a 2022-07-04 21:38:21 +02:00
Simon Lindholm 3b181ab40a Remove invalid assert 2022-07-04 19:38:49 +02:00
Simon Lindholm a47a2e5e8b Allow building with older GCC 2022-07-04 19:27:23 +02:00
Simon Lindholm 228bf4663e File handles 2022-07-04 00:42:47 +02:00
Mark Street 84cb52fe70 FileTimeToSystemTime, SetFileTime 2022-07-04 00:05:30 +02:00