More platform layer functions cleanup
This commit is contained in:
parent
91612e48c7
commit
3d9851fbe2
|
@ -499,13 +499,13 @@ SetApplicationLinks (context* Context, win32_dll_refresh DLL, work_queue* WorkQu
|
||||||
internal u8*
|
internal u8*
|
||||||
DEBUGAlloc(s32 ElementSize, s32 ElementCount)
|
DEBUGAlloc(s32 ElementSize, s32 ElementCount)
|
||||||
{
|
{
|
||||||
return Win32BasicAlloc(ElementSize * ElementCount);
|
return Win32Alloc(ElementSize * ElementCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal u8*
|
internal u8*
|
||||||
Win32Realloc(u8* Buf, s32 OldSize, s32 NewSize)
|
Win32Realloc(u8* Buf, s32 OldSize, s32 NewSize)
|
||||||
{
|
{
|
||||||
u8* NewMemory = Win32BasicAlloc(NewSize);
|
u8* NewMemory = Win32Alloc(NewSize);
|
||||||
GSMemCopy(Buf, NewMemory, OldSize);
|
GSMemCopy(Buf, NewMemory, OldSize);
|
||||||
return NewMemory;
|
return NewMemory;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ WinMain (
|
||||||
if (HotLoadDLL(&DLLRefresh))
|
if (HotLoadDLL(&DLLRefresh))
|
||||||
{
|
{
|
||||||
SetApplicationLinks(&Context, DLLRefresh, &WorkQueue);
|
SetApplicationLinks(&Context, DLLRefresh, &WorkQueue);
|
||||||
Context.ReloadStaticData(Context, GlobalDebugServices, Win32BasicAlloc, Win32Free);
|
Context.ReloadStaticData(Context, GlobalDebugServices, Win32Alloc, Win32Free);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -627,7 +627,7 @@ WinMain (
|
||||||
u8* RenderMemory = Win32Alloc(RenderMemorySize);
|
u8* RenderMemory = Win32Alloc(RenderMemorySize);
|
||||||
render_command_buffer RenderBuffer = AllocateRenderCommandBuffer(RenderMemory, RenderMemorySize, Win32Realloc);
|
render_command_buffer RenderBuffer = AllocateRenderCommandBuffer(RenderMemory, RenderMemorySize, Win32Realloc);
|
||||||
|
|
||||||
Context.InitializeApplication(Context, Win32BasicAlloc, Win32Free);
|
Context.InitializeApplication(Context, Win32Alloc, Win32Free);
|
||||||
|
|
||||||
Running = true;
|
Running = true;
|
||||||
Context.WindowIsVisible = true;
|
Context.WindowIsVisible = true;
|
||||||
|
@ -643,7 +643,7 @@ WinMain (
|
||||||
if (HotLoadDLL(&DLLRefresh))
|
if (HotLoadDLL(&DLLRefresh))
|
||||||
{
|
{
|
||||||
SetApplicationLinks(&Context, DLLRefresh, &WorkQueue);
|
SetApplicationLinks(&Context, DLLRefresh, &WorkQueue);
|
||||||
Context.ReloadStaticData(Context, GlobalDebugServices, Win32BasicAlloc, Win32Free);
|
Context.ReloadStaticData(Context, GlobalDebugServices, Win32Alloc, Win32Free);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Mouse Position
|
{ // Mouse Position
|
||||||
|
|
|
@ -13,20 +13,12 @@ PLATFORM_READ_ENTIRE_FILE(Win32ReadEntireFile)
|
||||||
platform_memory_result Result = {};
|
platform_memory_result Result = {};
|
||||||
Result.Error = PLATFORM_MEMORY_NO_ERROR;
|
Result.Error = PLATFORM_MEMORY_NO_ERROR;
|
||||||
|
|
||||||
HANDLE FileHandle = CreateFileA (
|
HANDLE FileHandle = CreateFileA (Path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
Path,
|
|
||||||
GENERIC_READ,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
OPEN_EXISTING,
|
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (FileHandle != INVALID_HANDLE_VALUE)
|
if (FileHandle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD FileSize = GetFileSize(FileHandle, NULL);
|
DWORD FileSize = GetFileSize(FileHandle, NULL);
|
||||||
Result.Base = (u8*)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE,
|
Result.Base = (u8*)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||||
PAGE_EXECUTE_READWRITE);
|
|
||||||
if (Result.Base)
|
if (Result.Base)
|
||||||
{
|
{
|
||||||
Result.Size = FileSize;
|
Result.Size = FileSize;
|
||||||
|
|
|
@ -8,17 +8,11 @@
|
||||||
//
|
//
|
||||||
#ifndef WIN32_FOLDHAUS_MEMORY_H
|
#ifndef WIN32_FOLDHAUS_MEMORY_H
|
||||||
|
|
||||||
internal u8*
|
|
||||||
Win32BasicAlloc (s32 Size)
|
|
||||||
{
|
|
||||||
return (u8*)VirtualAlloc(NULL, Size,
|
|
||||||
MEM_COMMIT | MEM_RESERVE,
|
|
||||||
PAGE_EXECUTE_READWRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
PLATFORM_ALLOC(Win32Alloc)
|
PLATFORM_ALLOC(Win32Alloc)
|
||||||
{
|
{
|
||||||
u8* Result = Win32BasicAlloc(Size);
|
u8* Result = (u8*)VirtualAlloc(NULL, Size,
|
||||||
|
MEM_COMMIT | MEM_RESERVE,
|
||||||
|
PAGE_EXECUTE_READWRITE);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +29,7 @@ PLATFORM_FREE(Win32Free)
|
||||||
|
|
||||||
PLATFORM_REALLOC(Win32Realloc)
|
PLATFORM_REALLOC(Win32Realloc)
|
||||||
{
|
{
|
||||||
u8* NewMemory = Win32BasicAlloc(NewSize);
|
u8* NewMemory = Win32Alloc(NewSize);
|
||||||
if (Base)
|
if (Base)
|
||||||
{
|
{
|
||||||
GSMemCopy(Base, NewMemory, OldSize);
|
GSMemCopy(Base, NewMemory, OldSize);
|
||||||
|
|
Loading…
Reference in New Issue