Skip to content

Commit

Permalink
Moved the rest of direct draw into library
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Hood committed Feb 23, 2021
1 parent 8318ed6 commit 7832e17
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 57 deletions.
26 changes: 0 additions & 26 deletions FullScreenToggle.c

This file was deleted.

3 changes: 0 additions & 3 deletions FullScreenToggle.h

This file was deleted.

16 changes: 0 additions & 16 deletions InitBasicWindowInstance.c

This file was deleted.

5 changes: 0 additions & 5 deletions InitBasicWindowInstance.h

This file was deleted.

4 changes: 0 additions & 4 deletions Vcc.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="EmuLoop.c" />
<ClCompile Include="FullScreenToggle.c" />
<ClCompile Include="InitBasicWindowInstance.c" />
<ClCompile Include="main.c" />
</ItemGroup>
<ItemGroup>
Expand All @@ -178,8 +176,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="EmuLoop.h" />
<ClInclude Include="FullScreenToggle.h" />
<ClInclude Include="InitBasicWindowInstance.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="fd502\fd502.vcxproj">
Expand Down
43 changes: 42 additions & 1 deletion library/DirectDraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "DirectDraw.h"
#include "Throttle.h"
#include "Config.h"
#include "PAKInterface.h"
#include "VCC.h"
#include "Graphics.h"

#include "systemstate.h"

Expand Down Expand Up @@ -754,4 +757,42 @@ extern "C" {

return TRUE;
}
}
}

extern "C" {
__declspec(dllexport) BOOL __cdecl InitInstance(HINSTANCE hInstance, HINSTANCE hResources, int nCmdShow)
{
DirectDrawState* ddState = GetDirectDrawState();

ddState->hInstance = hInstance;
ddState->CmdShow = nCmdShow;

LoadString(hResources, IDS_APP_TITLE, ddState->TitleBarText, MAX_LOADSTRING);
LoadString(hResources, IDS_APP_TITLE, ddState->AppNameText, MAX_LOADSTRING);

return TRUE;
}
}

extern "C" {
__declspec(dllexport) void __cdecl FullScreenToggle(WNDPROC WndProc)
{
VccState* vccState = GetVccState();

PauseAudio(true);

if (!CreateDirectDrawWindow(&(vccState->EmuState), WndProc))
{
MessageBox(0, "Can't rebuild primary Window", "Error", 0);

exit(0);
}

InvalidateBorder();
RefreshDynamicMenu(&(vccState->EmuState));

vccState->EmuState.ConfigDialog = NULL;

PauseAudio(false);
}
}
2 changes: 2 additions & 0 deletions library/DirectDraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ extern "C" __declspec(dllexport) void __cdecl DoCls(SystemState* systemState);
extern "C" __declspec(dllexport) float __cdecl Static(SystemState* systemState);

extern "C" __declspec(dllexport) bool __cdecl CreateDirectDrawWindow(SystemState* systemState, WNDPROC WndProc);
extern "C" __declspec(dllexport) BOOL __cdecl InitInstance(HINSTANCE hInstance, HINSTANCE hResources, int nCmdShow);
extern "C" __declspec(dllexport) void __cdecl FullScreenToggle(WNDPROC WndProc);
2 changes: 0 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "library/Callbacks.h"

#include "EmuLoop.h"
#include "FullScreenToggle.h"
#include "InitBasicWindowInstance.h"

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

Expand Down

0 comments on commit 7832e17

Please sign in to comment.