Skip to content

Commit

Permalink
standalone: move pinmame, flex, b2s, and pup into one window
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Jan 20, 2025
1 parent 7cc4815 commit 37ec010
Show file tree
Hide file tree
Showing 59 changed files with 1,511 additions and 1,526 deletions.
101 changes: 50 additions & 51 deletions src/assets/Default_VPinballX.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,78 +17,77 @@ LaunchTable =
HighDPI =
VPRegPath =
PinMAMEPath =
PinMAMEWindow =
PinMAMEWindowX =
PinMAMEWindowY =
PinMAMEWindowWidth =
PinMAMEWindowHeight =
PinMAMEWindowRotation =
PinMAMEOutput =
PinMAMEFullScreen =
PinMAMEWndX =
PinMAMEWndY =
PinMAMEWidth =
PinMAMEHeight =
AltSound =
AltColor =
FlexDMDWindow =
FlexDMDWindowX =
FlexDMDWindowY =
FlexDMDWindowWidth =
FlexDMDWindowHeight =
FlexDMDWindowRotation =
FlexDMDOutput =
FlexDMDFullScreen =
FlexDMDWndX =
FlexDMDWndY =
FlexDMDWidth =
FlexDMDHeight =
B2SHideGrill =
B2SHideB2SDMD =
B2SHideB2SBackglass =
B2SHideDMD =
B2SDualMode =
B2SWindows =
B2SBackglassX =
B2SBackglassY =
B2SBackglassOutput =
B2SBackglassFullScreen =
B2SBackglassWndX =
B2SBackglassWndY =
B2SBackglassWidth =
B2SBackglassHeight =
B2SBackglassRotation =
B2SDMDX =
B2SDMDY =
B2SDMDOutput =
B2SDMDFullScreen =
B2SDMDWndX =
B2SDMDWndY =
B2SDMDWidth =
B2SDMDHeight =
B2SDMDRotation =
B2SDMDFlipY =
B2SPlugins =
PUPCapture =
PUPPlugin =
PUPWindows =
PUPTopperScreen =
PUPTopperWindow =
PUPTopperWindowX =
PUPTopperWindowY =
PUPTopperWindowWidth =
PUPTopperWindowHeight =
PUPTopperWindowRotation =
PUPTopperOutput =
PUPTopperFullScreen =
PUPTopperWndX =
PUPTopperWndY =
PUPTopperWidth =
PUPTopperHeight =
PUPBackglassScreen =
PUPBackglassWindow =
PUPBackglassWindowX =
PUPBackglassWindowY =
PUPBackglassWindowWidth =
PUPBackglassWindowHeight =
PUPBackglassWindowRotation =
PUPBackglassOutput =
PUPBackglassFullScreen =
PUPBackglassWndX =
PUPBackglassWndY =
PUPBackglassWidth =
PUPBackglassHeight =
PUPDMDScreen =
PUPDMDWindow =
PUPDMDWindowX =
PUPDMDWindowY =
PUPDMDWindowWidth =
PUPDMDWindowHeight =
PUPDMDWindowRotation =
PUPDMDOutput =
PUPDMDFullScreen =
PUPDMDWndX =
PUPDMDWndY =
PUPDMDWidth =
PUPDMDHeight =
PUPPlayfieldScreen =
PUPPlayfieldWindow =
PUPPlayfieldWindowX =
PUPPlayfieldWindowY =
PUPPlayfieldWindowWidth =
PUPPlayfieldWindowHeight =
PUPPlayfieldWindowRotation =
PUPPlayfieldOutput =
PUPPlayfieldFullScreen =
PUPPlayfieldWndX =
PUPPlayfieldWndY =
PUPPlayfieldWidth =
PUPPlayfieldHeight =
PUPFullDMDScreen =
PUPFullDMDWindow =
PUPFullDMDWindowX =
PUPFullDMDWindowY =
PUPFullDMDWindowWidth =
PUPFullDMDWindowHeight =
PUPFullDMDWindowRotation =
PUPFullDMDOutput =
PUPFullDMDFullScreen =
PUPFullDMDWndX =
PUPFullDMDWndY =
PUPFullDMDWidth =
PUPFullDMDHeight =
DOFPlugin =
WindowRenderMode =
ZeDMD =
ZeDMDDevice =
ZeDMDDebug =
Expand Down
Binary file added src/assets/LiberationSans-Regular.ttf
Binary file not shown.
19 changes: 15 additions & 4 deletions src/core/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,17 @@ Player::Player(PinTable *const editor_table, PinTable *const live_table, const i
throw hr;
}

#ifdef __LIBVPINBALL__
VPinballLib::WindowCreatedData windowCreatedData = {};
#if (defined(__APPLE__) && (defined(TARGET_OS_IOS) && TARGET_OS_IOS))
SDL_PropertiesID props = SDL_GetWindowProperties(m_playfieldWnd->GetCore());
windowCreatedData.pWindow = (void*)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER, NULL);
windowCreatedData.pData = (void*)SDL_GetRenderMetalLayer(SDL_GetRenderer(m_playfieldWnd->GetCore()));
#endif
windowCreatedData.pTitle = SDL_GetWindowTitle(m_playfieldWnd->GetCore());
VPinballLib::VPinball::SendEvent(VPinballLib::Event::WindowCreated, &windowCreatedData);
#endif

#if defined(ENABLE_BGFX)
if (m_vrDevice == nullptr) // Anciliary windows are not yet supported while in VR mode
{
Expand Down Expand Up @@ -2209,6 +2220,10 @@ void Player::PrepareFrame(const std::function<void()>& sync)
}
}

#ifdef __STANDALONE__
g_pStandalone->Render();
#endif

m_logicProfiler.ExitProfileSection();
#ifdef MSVC_CONCURRENCY_VIEWER
delete tagSpan;
Expand Down Expand Up @@ -2304,10 +2319,6 @@ void Player::FinishFrame()
}
}

#ifdef __STANDALONE__
g_pStandalone->Render();
#endif

// Brute force stop: blast into space
if (m_closing == CS_FORCE_STOP)
exit(-9999);
Expand Down
44 changes: 33 additions & 11 deletions src/parts/decal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ Decal *Decal::CopyForPlay(PinTable *live_table) const
STANDARD_EDITABLE_COPY_FOR_PLAY_IMPL(Decal, live_table)
#ifndef __STANDALONE__
m_pIFont->Clone(&dst->m_pIFont);
#endif
#ifdef __STANDALONE__
dst->m_fontItalic = m_fontItalic;
dst->m_fontUnderline = m_fontUnderline;
dst->m_fontStrikeThrough = m_fontStrikeThrough;
dst->m_fontBold = m_fontBold;
dst->m_fontSize = m_fontSize;
dst->m_fontName = m_fontName;
#endif
dst->EnsureSize();
return dst;
Expand Down Expand Up @@ -392,20 +400,34 @@ bool Decal::LoadToken(const int id, BiffReader * const pbr)
m_pIFont->QueryInterface(IID_IPersistStream, (void **)&ips);
ips->Load(pbr->m_pistream);
SAFE_RELEASE_NO_RCC(ips);

#else
// https://github.com/freezy/VisualPinball.Engine/blob/master/VisualPinball.Engine/VPT/Font.cs#L25

char data[255];

ULONG read;
pbr->ReadBytes(data, 3, &read);
pbr->ReadBytes(data, 1, &read); // Italic
pbr->ReadBytes(data, 2, &read); // Weight
pbr->ReadBytes(data, 4, &read); // Size
pbr->ReadBytes(data, 1, &read); // nameLen
pbr->ReadBytes(data, (int)data[0], &read); // name
BYTE buffer[255];
BYTE attributes;
short weight;
int size;
int len;

pbr->ReadBytes(buffer, 1, &read); // version
pbr->ReadBytes(buffer, sizeof(short), &read); // charset
pbr->ReadBytes(&attributes, sizeof(BYTE), &read); // attributes
m_fontItalic = (attributes & 0x02) > 0;
m_fontUnderline = (attributes & 0x04) > 0;
m_fontStrikeThrough = (attributes & 0x08) > 0;
pbr->ReadBytes(&weight, sizeof(short), &read); // weight
m_fontBold = weight > 550;
pbr->ReadBytes(&size, sizeof(int), &read); // size
m_fontSize = (float)size / 10000;
pbr->ReadBytes(buffer, 1, &read); // name length
len = (int)buffer[0];
if (len > 0) {
pbr->ReadBytes(buffer, len, &read); // name
m_fontName = string(reinterpret_cast<char*>(buffer), len);
}
else
m_fontName.clear();
#endif

break;
}
default: ISelect::LoadToken(id, pbr); break;
Expand Down
8 changes: 8 additions & 0 deletions src/parts/decal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class Decal :

DecalData m_d;
IFont *m_pIFont = nullptr;
#ifdef __STANDALONE__
bool m_fontItalic;
bool m_fontUnderline;
bool m_fontStrikeThrough;
bool m_fontBold;
float m_fontSize;
string m_fontName;
#endif

private:
void GetTextSize(int * const px, int * const py);
Expand Down
24 changes: 15 additions & 9 deletions src/parts/dispreel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,16 +584,22 @@ bool DispReel::LoadToken(const int id, BiffReader * const pbr)

pIFont->Release();
#else
// https://github.com/freezy/VisualPinball.Engine/blob/master/VisualPinball.Engine/VPT/Font.cs#L25
char data[255];

ULONG read;
pbr->ReadBytes(data, 3, &read);
pbr->ReadBytes(data, 1, &read); // Italic
pbr->ReadBytes(data, 2, &read); // Weight
pbr->ReadBytes(data, 4, &read); // Size
pbr->ReadBytes(data, 1, &read); // nameLen
pbr->ReadBytes(data, (int)data[0], &read); // name
BYTE buffer[255];
BYTE attributes;
short weight;
int size;
int len;

pbr->ReadBytes(buffer, 1, &read); // version
pbr->ReadBytes(buffer, sizeof(short), &read); // charset
pbr->ReadBytes(&attributes, sizeof(BYTE), &read); // attributes
pbr->ReadBytes(&weight, sizeof(short), &read); // weight
pbr->ReadBytes(&size, sizeof(int), &read); // size
pbr->ReadBytes(buffer, 1, &read); // name length
len = (int)buffer[0];
if (len > 0)
pbr->ReadBytes(buffer, len, &read); // name
#endif

break;
Expand Down
3 changes: 3 additions & 0 deletions src/parts/flasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,9 @@ void Flasher::Render(const unsigned int renderMask)
// Not yet implemented
break;
}

default:
break;
}

if (m_backglass)
Expand Down
8 changes: 0 additions & 8 deletions src/parts/pintable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,10 +2622,6 @@ void PinTable::Play(const int playMode)
if (isPFWnd)
ImGui_ImplSDL3_ProcessEvent(&e);

#ifdef __STANDALONE__
g_pStandalone->ProcessEvent(&e);
#endif

#ifdef ENABLE_SDL_INPUT
if (g_pplayer->m_pininput.GetInputAPI() == PinInput::PI_SDL)
g_pplayer->m_pininput.HandleSDLEvent(e);
Expand All @@ -2635,10 +2631,6 @@ void PinTable::Play(const int playMode)
if ((usec() - startTick) > 1000ull)
break;
}

#ifdef __STANDALONE__
g_pStandalone->ProcessUpdates();
#endif
};

#elif !defined(__STANDALONE__)
Expand Down
Loading

0 comments on commit 37ec010

Please sign in to comment.