#include "classes.h" // 00a18aa0 KAGE::Graphics::Manager::Manager() { void *local_10; uint8_t *puStack_c; uint32_t local_8; puStack_c = &DAT_00b11133; local_10 = ExceptionList; ExceptionList = &local_10; g_graphicsManager_flags = 0; local_8 = 0; DAT_00c798e0 = ManagerBase::vftable; (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c798e8))))->KColor::SetFromARGB(0xffffffff); g_graphicsManager_blendMode[1] = 1; DAT_00c798fc = &DAT_bf800000; if ((g_graphicsManager_flags & 4) == 0) { g_graphicsManager_blendMode[1] = 6; } g_graphicsManager_blendMode[0] = 0; g_graphicsManager_blendMode[2] = 7; g_graphicsManager_blendMode[3] = 1; g_graphicsManager_blendMode[4] = 7; _DAT_00c79914 = GHIDRA_CAST(0x0); _DAT_00c79918 = 0; _DAT_00c7991c = 0; _DAT_00c79920 = 0; _DAT_00c79924 = 0; _DAT_00c79914 = operator_new(8); _DAT_00c79914[1] = 0; *_DAT_00c79914 = &DAT_00c79914; (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; _DAT_00c7994c = GHIDRA_CAST(0x0); DAT_00c79950 = 0; DAT_00c79954 = 0; DAT_00c79958 = 0; DAT_00c7995c = 0; _DAT_00c7994c = operator_new(8); _DAT_00c7994c[1] = 0; *_DAT_00c7994c = &DAT_00c7994c; _DAT_00c79960 = 0; DAT_00c79964 = 0; DAT_00c79968 = 0; local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); DAT_00c7996c = (void *)0x0; DAT_00c79970 = 0; DAT_00c7996c = operator_new(0x18); *(void **)DAT_00c7996c = DAT_00c7996c; *(void **)(GHIDRA_CAST(DAT_00c7996c) + 4) = DAT_00c7996c; *(void **)(GHIDRA_CAST(DAT_00c7996c) + 8) = DAT_00c7996c; *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7996c) + 0xc)) = 0x101; g_graphicsManager_flags = g_graphicsManager_flags | 0x12; DAT_00c79974 = 0; _DAT_00c79978 = 1; DAT_00c79988 = 0; DAT_00c79984 = 0; DAT_00c79928 = 0; DAT_00c7992c = 0; uRam00c79930 = 0; uRam00c79934 = 0; DAT_00c7997c = 0x44f00000; _DAT_00c79938 = 0; uRam00c7993c = 0; uRam00c79940 = 0; uRam00c79944 = 0; DAT_00c79980 = 0x44870000; _DAT_00c7998c = 0; _DAT_00c79990 = 0; _DAT_00c79994 = 0xffffffff; _DAT_00c79998 = 0xffffffff; local_8 = 4; DAT_00c798e0 = vftable; g_glfwWindow = (void *)0x0; DAT_00c799a4 = 0; DAT_00c799a0 = 0; DAT_00c799ac = 0; DAT_00c799a8 = 0; DAT_00c799b4 = 0; DAT_00c799b0 = 0; DAT_00c799b8 = (void *)0x0; _DAT_00c799bc = 0; DAT_00c799b8 = operator_new(0x10); *(void **)DAT_00c799b8 = DAT_00c799b8; *(void **)(GHIDRA_CAST(DAT_00c799b8) + 4) = DAT_00c799b8; (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; _DAT_00c799c0 = (void *)0x0; _DAT_00c799c4 = 0; _DAT_00c799c0 = operator_new(0x10); *(void **)_DAT_00c799c0 = _DAT_00c799c0; *(void **)(GHIDRA_CAST(_DAT_00c799c0) + 4) = _DAT_00c799c0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 6; _DAT_00c799c8 = (void *)0x0; _DAT_00c799cc = 0; _DAT_00c799c8 = operator_new(0x10); *(void **)_DAT_00c799c8 = _DAT_00c799c8; *(void **)(GHIDRA_CAST(_DAT_00c799c8) + 4) = _DAT_00c799c8; local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),7); DAT_00c799d0 = (void *)0x0; _DAT_00c799d4 = 0; DAT_00c799d0 = operator_new(0x10); *(void **)DAT_00c799d0 = DAT_00c799d0; *(void **)(GHIDRA_CAST(DAT_00c799d0) + 4) = DAT_00c799d0; g_graphicsManager_flags = g_graphicsManager_flags | 0x200; ExceptionList = local_10; return &DAT_00c798e0; } // 00a18e90 uint8_t KAGE::Graphics::Manager::FUN_00a649b0() { char cVar1; int iVar2; HWND hwnd; uint32_t windowStyle; uint32_t uVar3; int *in_ECX; KColor clearColor; char *indexedTextureShaderSource; uint32_t local_40; char *local_3c; uint32_t local_38; char *colorTextureShaderSource; uint32_t local_30; char *local_2c; uint32_t local_28; char *colorShaderSource; uint32_t local_20; char *local_1c; uint32_t local_18; void *bufferObject; void *local_10; uint8_t *puStack_c; uint32_t local_8; local_8 = 0xffffffff; puStack_c = &LAB_00b11164; local_10 = ExceptionList; ExceptionList = &local_10; DAT_00c7de7c = FUN_00a19dd0; iVar2 = glfwInit(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); if (iVar2 != 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("GLFW failed to initialize\n")); } FUN_00a19450(&DAT_00c79a34); in_ECX[0x32] = DAT_00c79a34; in_ECX[0x33] = DAT_00c79a38; cVar1 = DAT_00c79a3c; uVar3 = in_ECX[1] | 0x400; if (DAT_00c79a3c == '\0') { uVar3 = in_ECX[1] & 0xfffffbff; } in_ECX[1] = uVar3; if (in_ECX[0x2f] != 0) { iVar2 = -0x10; hwnd = (HWND)FUN_00a5f090(in_ECX[0x2f]); windowStyle = GetWindowLongA(hwnd,iVar2); uVar3 = windowStyle & 0xfffeffff; if (cVar1 != '\0') { uVar3 = windowStyle | 0x10000; } iVar2 = -0x10; hwnd = (HWND)FUN_00a5f090(); SetWindowLongA(hwnd,iVar2,uVar3); } cVar1 = KAGE_Graphics::create_window(); if (cVar1 == '\0') { ExceptionList = local_10; return 0; } iVar2 = in_ECX[0x2f]; if (iVar2 == 0) { _wassert(L"window != NULL", L"C:\\nicalis\\builderbob\\projects\\KAGE\\Source\\Platforms\\PC\\Shared\\Source\\External\\gl\\GLFW_3.4\\src\\window.c" ,0x333); } if (_glfw == 0) { _glfwInputError(0x10001,0); } else if (*GHIDRA_CAST((iVar2 + 0x40)) == 0) { (*DAT_00c73748)(iVar2); if (*GHIDRA_CAST((iVar2 + 0x14)) != 0) { (*DAT_00c73754)(iVar2); } } colorShaderSource = "\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\n\nvarying\t\tvec4\t\t\tColor0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tColor0 = Color;\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n}\n\n" ; local_20 = 0xca; local_1c = "\n\n#ifndef GL_ES\n\t#define lowp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\n\nvoid\t\tmain( void )\n{\n\tgl_FragColor = Color0;\n\tif( gl_FragColor.a == 0.0 )\t\tdiscard;\n}\n\n" ; local_18 = 0x9a; FUN_00a13fa0("KAGE_ColorShader",&PTR_s_Position_00c0f8c0,&colorShaderSource); colorTextureShaderSource = "\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\nattribute\tvec2\t\t\tTexCoord;\n\nvarying\t\tvec4\t\t\tColor0;\nvarying\t\tvec2\t\t\tTexCoord0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n\tColor0 = Color;\n\tTexCoord0 = TexCoord;\n}\n\n" ; local_30 = 0x117; local_2c = "\n\n#ifndef GL_ES\n\t#define lowp\n\t#define highp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\nvarying\t\thighp vec2\t\tTexCoord0;\n\nuniform\t\tsampler2D\t\tTexture0;\n\nvoid\t\tmain( void )\n{\n\tgl_FragColor = texture2D( Texture0, TexCoord0 ) * Color0;\n\tif( gl_FragColor.a == 0.0 )\t\tdiscard;\n}\n\n" ; local_28 = 0x10b; FUN_00a13fa0("KAGE_ColorTextureShader",&PTR_s_Position_00c0f8f0,&colorTextureShaderSource); indexedTextureShaderSource = "\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\nattribute\tvec2\t\t\tTexCoord;\n\nvarying\t\tvec4\t\t\tColor0;\nvarying\t\tvec2\t\t\tTexCoord0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n\tColor0 = Color;\n\tTexCoord0 = TexCoord;\n}\n\n" ; local_40 = 0x117; local_3c = "\n\n#ifndef GL_ES\n\t#define lowp\n\t#define highp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\nvarying\t\thighp vec2\t\tTexCoord0;\n\nuniform\t\tsampler2D\t\tTexture0;\nuniform\t\tsampler2D\t\tTexture1;\n\nvoid\t\tmain( void )\n{\n\tvec4\tPaletteIndex = texture2D( Texture0, TexCoord0 );\n\tvec4\tOutputColor = texture2D( Texture1, PaletteIndex.xy ) * Color0;\n\tif( OutputColor.w == 0.0 )\t\tdiscard;\n\tgl_FragColor = OutputColor;\n}\n\n" ; local_38 = 0x186; FUN_00a13fa0("KAGE_IndexedTextureShader",&PTR_s_Position_00c0f8f0,&indexedTextureShaderSource); (**(code **)(*in_ECX + 0x78))(); (**(code **)(*in_ECX + 0x18))(0,1); bufferObject = operator_new(0x10); local_8 = 0; if (bufferObject == (void *)0x0) { DAT_00c7367c = (void *)0x0; } else { DAT_00c7367c = GraphicsBufferObject::GraphicsBufferObject(bufferObject); } local_8 = 0xffffffff; *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7367c) + 0xc)) = 1; (GHIDRA_CAST((&clearColor)))->KColor::SetFromARGB(0xff000000); (**(code **)(*in_ECX + 0x58))(clearColor._red,clearColor._green,clearColor._blue); _DAT_00c379b4 = _DAT_00c379b4 | 1; (**(code **)(DAT_00c37990 + 4))(); _DAT_00c37984 = _DAT_00c37984 | 1; in_ECX[1] = in_ECX[1] | 1; g_imageReleaseFn = FUN_00a12240; g_renderTargetReleaseFn = FUN_00a12240; ExceptionList = local_10; return 1; }