UWP: Really fix launcher rendering

This commit is contained in:
UnknownShadow200 2024-11-02 18:21:11 +11:00
parent 33266d8fe1
commit 292c847777
2 changed files with 16 additions and 14 deletions

View file

@ -327,7 +327,7 @@ static DWORD WINAPI ExecThread(void* param) {
void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char* name) { void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char* name) {
DWORD threadID; DWORD threadID;
HANDLE thread = CreateThread(NULL, 0, ExecThread, (void*)func, CREATE_SUSPENDED, &threadID); HANDLE thread = CreateThread(NULL, 0, ExecThread, (void*)func, CREATE_SUSPENDED, &threadID);
if (!thread) Logger_Abort2(GetLastError(), "Creating thread"); if (!thread) Process_Abort2(GetLastError(), "Creating thread");
*handle = thread; *handle = thread;
ResumeThread(thread); ResumeThread(thread);
@ -335,7 +335,7 @@ void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char*
void Thread_Detach(void* handle) { void Thread_Detach(void* handle) {
if (!CloseHandle((HANDLE)handle)) { if (!CloseHandle((HANDLE)handle)) {
Logger_Abort2(GetLastError(), "Freeing thread handle"); Process_Abort2(GetLastError(), "Freeing thread handle");
} }
} }
@ -360,14 +360,14 @@ void Mutex_Unlock(void* handle) { LeaveCriticalSection((CRITICAL_SECTION*)handle
void* Waitable_Create(const char* name) { void* Waitable_Create(const char* name) {
void* handle = CreateEventA(NULL, false, false, NULL); void* handle = CreateEventA(NULL, false, false, NULL);
if (!handle) { if (!handle) {
Logger_Abort2(GetLastError(), "Creating waitable"); Process_Abort2(GetLastError(), "Creating waitable");
} }
return handle; return handle;
} }
void Waitable_Free(void* handle) { void Waitable_Free(void* handle) {
if (!CloseHandle((HANDLE)handle)) { if (!CloseHandle((HANDLE)handle)) {
Logger_Abort2(GetLastError(), "Freeing waitable"); Process_Abort2(GetLastError(), "Freeing waitable");
} }
} }
@ -392,7 +392,7 @@ static cc_result ParseHostNew(char* host, int port, cc_sockaddr* addrs, int* num
struct addrinfo hints = { 0 }; struct addrinfo hints = { 0 };
struct addrinfo* result; struct addrinfo* result;
struct addrinfo* cur; struct addrinfo* cur;
int res, i = 0; int i = 0;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;
@ -401,7 +401,7 @@ static cc_result ParseHostNew(char* host, int port, cc_sockaddr* addrs, int* num
String_AppendInt(&portStr, port); String_AppendInt(&portStr, port);
portRaw[portStr.length] = '\0'; portRaw[portStr.length] = '\0';
res = getaddrinfo(host, portRaw, &hints, &result); int res = getaddrinfo(host, portRaw, &hints, &result);
if (res == WSAHOST_NOT_FOUND) return SOCK_ERR_UNKNOWN_HOST; if (res == WSAHOST_NOT_FOUND) return SOCK_ERR_UNKNOWN_HOST;
if (res) return res; if (res) return res;
@ -718,7 +718,7 @@ void Platform_EncodeString(cc_winstring* dst, const cc_string* src) {
cc_unichar* uni; cc_unichar* uni;
char* ansi; char* ansi;
int i; int i;
if (src->length > FILENAME_SIZE) Logger_Abort("String too long to expand"); if (src->length > FILENAME_SIZE) Process_Abort("String too long to expand");
uni = dst->uni; uni = dst->uni;
for (i = 0; i < src->length; i++) for (i = 0; i < src->length; i++)

View file

@ -30,6 +30,7 @@ using namespace Windows::UI::Input;
#include "../../src/Options.h" #include "../../src/Options.h"
#include "../../src/Errors.h" #include "../../src/Errors.h"
#include "../../src/Graphics.h" #include "../../src/Graphics.h"
#include "../../src/Game.h"
#define UWP_STRING(str) ((wchar_t*)(str)->uni) #define UWP_STRING(str) ((wchar_t*)(str)->uni)
@ -146,6 +147,10 @@ static void ShowDialogCore(const char* title, const char* msg) {
static cc_result OpenSaveFileDialog(const cc_string* filters, FileDialogCallback callback, cc_bool load, static cc_result OpenSaveFileDialog(const cc_string* filters, FileDialogCallback callback, cc_bool load,
const char* const* fileExts, const cc_string* defaultName) { const char* const* fileExts, const cc_string* defaultName) {
return ERR_NOT_SUPPORTED; return ERR_NOT_SUPPORTED;
//auto picker = Windows::Storage::Pickers::FileOpenPicker();
//picker.FileTypeFilter().Append(hstring(L".jpg"));
//Windows::Storage::StorageFile file = picker->PickSingleFileAsync();
} }
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) { cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
@ -212,6 +217,10 @@ void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
if (!Gfx.Created) Gfx_Create(); if (!Gfx.Created) Gfx_Create();
fb_tex = Gfx_CreateTexture(bmp, TEXTURE_FLAG_NONPOW2, false); fb_tex = Gfx_CreateTexture(bmp, TEXTURE_FLAG_NONPOW2, false);
AllocateVB(); AllocateVB();
Game.Width = Window_Main.Width;
Game.Height = Window_Main.Height;
Gfx_OnWindowResize();
} }
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) { void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
@ -274,13 +283,6 @@ void Window_DisableRawMouse(void) {
} }
void OpenFileDialog(void) {
auto picker = Windows::Storage::Pickers::FileOpenPicker();
//picker.FileTypeFilter().Append(hstring(L".jpg"));
//Windows::Storage::StorageFile file = picker->PickSingleFileAsync();
}
struct CCApp : implements<CCApp, IFrameworkViewSource, IFrameworkView> struct CCApp : implements<CCApp, IFrameworkViewSource, IFrameworkView>
{ {