mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Xbox: Add support for disabling stuff that doesn't work in cxbx-reloaded
This commit is contained in:
parent
8a3f02dc0c
commit
e0970e1c9f
@ -164,7 +164,7 @@ cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCall
|
|||||||
} while (FindNextFileA(find, &eA));
|
} while (FindNextFileA(find, &eA));
|
||||||
|
|
||||||
res = GetLastError(); /* return code from FindNextFile */
|
res = GetLastError(); /* return code from FindNextFile */
|
||||||
FindClose(find);
|
NtClose(find);
|
||||||
return res == ERROR_NO_MORE_FILES ? 0 : res;
|
return res == ERROR_NO_MORE_FILES ? 0 : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,9 +245,7 @@ void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char*
|
|||||||
|
|
||||||
void Thread_Detach(void* handle) {
|
void Thread_Detach(void* handle) {
|
||||||
NTSTATUS status = NtClose((HANDLE)handle);
|
NTSTATUS status = NtClose((HANDLE)handle);
|
||||||
if (!NT_SUCCESS(status)) {
|
if (!NT_SUCCESS(status)) Logger_Abort2(status, "Freeing thread handle");
|
||||||
Logger_Abort2(status, "Freeing thread handle");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread_Join(void* handle) {
|
void Thread_Join(void* handle) {
|
||||||
@ -265,24 +263,32 @@ void Mutex_Free(void* handle) {
|
|||||||
RtlDeleteCriticalSection((CRITICAL_SECTION*)handle);
|
RtlDeleteCriticalSection((CRITICAL_SECTION*)handle);
|
||||||
Mem_Free(handle);
|
Mem_Free(handle);
|
||||||
}
|
}
|
||||||
void Mutex_Lock(void* handle) { RtlEnterCriticalSection((CRITICAL_SECTION*)handle); }
|
|
||||||
void Mutex_Unlock(void* handle) { RtlLeaveCriticalSection((CRITICAL_SECTION*)handle); }
|
void Mutex_Lock(void* handle) {
|
||||||
|
RtlEnterCriticalSection((CRITICAL_SECTION*)handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mutex_Unlock(void* handle) {
|
||||||
|
RtlLeaveCriticalSection((CRITICAL_SECTION*)handle);
|
||||||
|
}
|
||||||
|
|
||||||
void* Waitable_Create(void) {
|
void* Waitable_Create(void) {
|
||||||
void* handle = CreateEventA(NULL, false, false, NULL);
|
HANDLE handle;
|
||||||
if (!handle) {
|
NTSTATUS status = NtCreateEvent(&handle, NULL, SynchronizationEvent, false);
|
||||||
Logger_Abort2(GetLastError(), "Creating waitable");
|
|
||||||
}
|
if (!NT_SUCCESS(status)) Logger_Abort2(status, "Creating waitable");
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waitable_Free(void* handle) {
|
void Waitable_Free(void* handle) {
|
||||||
if (!CloseHandle((HANDLE)handle)) {
|
NTSTATUS status = NtClose((HANDLE)handle);
|
||||||
Logger_Abort2(GetLastError(), "Freeing waitable");
|
if (!NT_SUCCESS(status)) Logger_Abort2(status, "Freeing waitable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Waitable_Signal(void* handle) {
|
||||||
|
NtSetEvent((HANDLE)handle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waitable_Signal(void* handle) { NtSetEvent((HANDLE)handle, NULL); }
|
|
||||||
void Waitable_Wait(void* handle) {
|
void Waitable_Wait(void* handle) {
|
||||||
WaitForSingleObject((HANDLE)handle, INFINITE);
|
WaitForSingleObject((HANDLE)handle, INFINITE);
|
||||||
}
|
}
|
||||||
@ -399,18 +405,20 @@ static void InitHDD(void) {
|
|||||||
} else {
|
} else {
|
||||||
hdd_mounted = nxMountDrive('E', "\\Device\\Harddisk0\\Partition1\\");
|
hdd_mounted = nxMountDrive('E', "\\Device\\Harddisk0\\Partition1\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hdd_mounted) {
|
if (!hdd_mounted) {
|
||||||
Platform_LogConst("Failed to mount E:/ from Data partition");
|
Platform_LogConst("Failed to mount E:/ from Data partition");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Directory_Create(&String_Empty); // create root ClassiCube folder
|
Directory_Create(&String_Empty); // create root ClassiCube folder
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Init(void) {
|
void Platform_Init(void) {
|
||||||
InitHDD();
|
InitHDD();
|
||||||
Stopwatch_Init();
|
Stopwatch_Init();
|
||||||
|
#ifndef CC_BUILD_CXBX
|
||||||
nxNetInit(NULL);
|
nxNetInit(NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Free(void) {
|
void Platform_Free(void) {
|
||||||
|
@ -40,6 +40,7 @@ static void OnDataReceived(UTR_T* utr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void OnDeviceChanged(xid_dev_t *xid_dev__, int status__) {
|
static void OnDeviceChanged(xid_dev_t *xid_dev__, int status__) {
|
||||||
|
Platform_LogConst("Getting devices");
|
||||||
xid_dev_t* xid_dev = usbh_xid_get_device_list();
|
xid_dev_t* xid_dev = usbh_xid_get_device_list();
|
||||||
Platform_LogConst("Devices check");
|
Platform_LogConst("Devices check");
|
||||||
|
|
||||||
@ -75,11 +76,13 @@ void Window_Init(void) {
|
|||||||
DisplayInfo.ContentOffsetX = 10;
|
DisplayInfo.ContentOffsetX = 10;
|
||||||
DisplayInfo.ContentOffsetY = 10;
|
DisplayInfo.ContentOffsetY = 10;
|
||||||
|
|
||||||
|
#ifndef CC_BUILD_CXBX
|
||||||
usbh_core_init();
|
usbh_core_init();
|
||||||
usbh_xid_init();
|
usbh_xid_init();
|
||||||
|
|
||||||
usbh_install_xid_conn_callback(OnDeviceChanged, OnDeviceChanged);
|
usbh_install_xid_conn_callback(OnDeviceChanged, OnDeviceChanged);
|
||||||
OnDeviceChanged(NULL, 0); // TODO useless call?
|
OnDeviceChanged(NULL, 0); // TODO useless call?
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_Free(void) { usbh_core_deinit(); }
|
void Window_Free(void) { usbh_core_deinit(); }
|
||||||
@ -108,7 +111,9 @@ void Window_RequestClose(void) {
|
|||||||
*----------------------------------------------------Input processing-----------------------------------------------------*
|
*----------------------------------------------------Input processing-----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Window_ProcessEvents(float delta) {
|
void Window_ProcessEvents(float delta) {
|
||||||
|
#ifndef CC_BUILD_CXBX
|
||||||
usbh_pooling_hubs();
|
usbh_pooling_hubs();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor_SetPosition(int x, int y) { } // Makes no sense for Xbox
|
void Cursor_SetPosition(int x, int y) { } // Makes no sense for Xbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user