mirror of https://github.com/decompals/wibo.git
Add armcc support (#39)
* armcc 5.04, ignore seh longjmps * Update CI link * Stub RtlUnwind entirely --------- Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
This commit is contained in:
parent
3e2d84fa69
commit
6e18120410
|
@ -19,7 +19,7 @@ jobs:
|
|||
|
||||
- name: Test
|
||||
run: |
|
||||
wget https://cdn.discordapp.com/attachments/727918646525165659/917185027656286218/GC_WII_COMPILERS.zip
|
||||
wget https://cdn.discordapp.com/attachments/727918646525165659/1129759991696457728/GC_WII_COMPILERS.zip
|
||||
unzip GC_WII_COMPILERS.zip
|
||||
MWCIncludes=. build/wibo GC/2.7/mwcceppc.exe -c test/test.c -Itest
|
||||
file test.o
|
||||
|
|
|
@ -550,6 +550,13 @@ namespace kernel32 {
|
|||
}
|
||||
|
||||
FindFirstFileHandle *handle = new FindFirstFileHandle();
|
||||
|
||||
if (!std::filesystem::exists(path.parent_path())) {
|
||||
wibo::lastError = 3; // ERROR_PATH_NOT_FOUND
|
||||
delete handle;
|
||||
return (void *) 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
std::filesystem::directory_iterator it(path.parent_path());
|
||||
handle->it = it;
|
||||
handle->pattern = path.filename().string();
|
||||
|
@ -564,6 +571,28 @@ namespace kernel32 {
|
|||
return handle;
|
||||
}
|
||||
|
||||
typedef enum _FINDEX_INFO_LEVELS {
|
||||
FindExInfoStandard,
|
||||
FindExInfoBasic,
|
||||
FindExInfoMaxInfoLevel
|
||||
} FINDEX_INFO_LEVELS;
|
||||
|
||||
typedef enum _FINDEX_SEARCH_OPS {
|
||||
FindExSearchNameMatch,
|
||||
FindExSearchLimitToDirectories,
|
||||
FindExSearchLimitToDevices,
|
||||
FindExSearchMaxSearchOp
|
||||
} FINDEX_SEARCH_OPS;
|
||||
|
||||
void *WIN_FUNC FindFirstFileExA(const char *lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, void *lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, void *lpSearchFilter, unsigned int dwAdditionalFlags) {
|
||||
assert(fInfoLevelId == FindExInfoStandard);
|
||||
|
||||
auto path = files::pathFromWindows(lpFileName);
|
||||
DEBUG_LOG("FindFirstFileExA %s (%s)\n", lpFileName, path.c_str());
|
||||
|
||||
return FindFirstFileA(lpFileName, (WIN32_FIND_DATA<char> *) lpFindFileData);
|
||||
}
|
||||
|
||||
int WIN_FUNC FindNextFileA(void *hFindFile, WIN32_FIND_DATA<char> *lpFindFileData) {
|
||||
FindFirstFileHandle *handle = (FindFirstFileHandle *) hFindFile;
|
||||
if (!findNextFile(handle)) {
|
||||
|
@ -1525,7 +1554,7 @@ namespace kernel32 {
|
|||
cchSrc = wstrlen(lpSrcStr) + 1;
|
||||
}
|
||||
// DEBUG_LOG("lpSrcStr: %s\n", lpSrcStr);
|
||||
return 0; // fail
|
||||
return 1; // success
|
||||
}
|
||||
|
||||
int WIN_FUNC LCMapStringA(int Locale, unsigned int dwMapFlags, const char* lpSrcStr, int cchSrc, char* lpDestStr, int cchDest) {
|
||||
|
@ -1595,10 +1624,18 @@ namespace kernel32 {
|
|||
memset(ListHead, 0, sizeof(SLIST_HEADER));
|
||||
}
|
||||
|
||||
void WIN_FUNC RtlUnwind(void *TargetFrame, void *TargetIp, void *ExceptionRecord, void *ReturnValue) {
|
||||
typedef struct _EXCEPTION_RECORD {
|
||||
unsigned int ExceptionCode;
|
||||
unsigned int ExceptionFlags;
|
||||
struct _EXCEPTION_RECORD *ExceptionRecord;
|
||||
void* ExceptionAddress;
|
||||
unsigned int NumberParameters;
|
||||
void* ExceptionInformation[15];
|
||||
} EXCEPTION_RECORD;
|
||||
|
||||
void WIN_FUNC RtlUnwind(void *TargetFrame, void *TargetIp, EXCEPTION_RECORD *ExceptionRecord, void *ReturnValue) {
|
||||
DEBUG_LOG("RtlUnwind %p %p %p %p\n", TargetFrame, TargetIp, ExceptionRecord, ReturnValue);
|
||||
printf("Aborting due to exception\n");
|
||||
exit(1);
|
||||
DEBUG_LOG("WARNING: Silently returning from RtlUnwind - exception handlers and clean up code may not be run");
|
||||
}
|
||||
|
||||
int WIN_FUNC InterlockedIncrement(int *Addend) {
|
||||
|
@ -1608,6 +1645,12 @@ namespace kernel32 {
|
|||
int WIN_FUNC InterlockedDecrement(int *Addend) {
|
||||
return *Addend -= 1;
|
||||
}
|
||||
|
||||
int WIN_FUNC InterlockedExchange(int *Target, int Value) {
|
||||
int initial = *Target;
|
||||
*Target = Value;
|
||||
return initial;
|
||||
}
|
||||
}
|
||||
|
||||
void *wibo::resolveKernel32(const char *name) {
|
||||
|
@ -1686,6 +1729,7 @@ void *wibo::resolveKernel32(const char *name) {
|
|||
if (strcmp(name, "GetFullPathNameA") == 0) return (void *) kernel32::GetFullPathNameA;
|
||||
if (strcmp(name, "GetShortPathNameA") == 0) return (void *) kernel32::GetShortPathNameA;
|
||||
if (strcmp(name, "FindFirstFileA") == 0) return (void *) kernel32::FindFirstFileA;
|
||||
if (strcmp(name, "FindFirstFileExA") == 0) return (void *) kernel32::FindFirstFileExA;
|
||||
if (strcmp(name, "FindNextFileA") == 0) return (void *) kernel32::FindNextFileA;
|
||||
if (strcmp(name, "FindClose") == 0) return (void *) kernel32::FindClose;
|
||||
if (strcmp(name, "GetFileAttributesA") == 0) return (void *) kernel32::GetFileAttributesA;
|
||||
|
@ -1771,6 +1815,7 @@ void *wibo::resolveKernel32(const char *name) {
|
|||
if (strcmp(name, "RtlUnwind") == 0) return (void *) kernel32::RtlUnwind;
|
||||
if (strcmp(name, "InterlockedIncrement") == 0) return (void *) kernel32::InterlockedIncrement;
|
||||
if (strcmp(name, "InterlockedDecrement") == 0) return (void *) kernel32::InterlockedDecrement;
|
||||
if (strcmp(name, "InterlockedExchange") == 0) return (void *) kernel32::InterlockedExchange;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue