mirror of
https://github.com/rrika/cdcEngineDXHR.git
synced 2024-11-23 13:39:54 +00:00
add Specialisation::BlockingChange
This commit is contained in:
parent
248a1bf972
commit
342beb4bb7
@ -9,6 +9,7 @@
|
||||
#include "cdcFile/ArchiveFileSystem.h"
|
||||
#include "cdcFile/FileHelpers.h"
|
||||
#include "cdcLocale/localstr.h"
|
||||
#include "cdcResource/Specialisation.h"
|
||||
|
||||
using namespace cdc;
|
||||
|
||||
@ -62,6 +63,14 @@ int main(int argc, char** argv) {
|
||||
displayConfig->lockWindowResolution = false;
|
||||
g_renderDevice = createPCDX11RenderDevice(hwnd1, 640, 480, 0);
|
||||
|
||||
{
|
||||
FileSystem *fs = getDefaultFileSystem();
|
||||
uint32_t mask = fs->getLanguageMask();
|
||||
mask &= 0x3fffffff;
|
||||
mask |= 0x80000000; // dx11
|
||||
Specialisation::BlockingChange(mask);
|
||||
}
|
||||
|
||||
MAIN_Init();
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../../rendering/PCDX11RenderDevice.h"
|
||||
#include "../../rendering/renderdevice.h"
|
||||
#include "cdcWorld/RenderLayer.h"
|
||||
#include "cdcResource/Specialisation.h"
|
||||
|
||||
using namespace cdc;
|
||||
|
||||
@ -132,6 +133,14 @@ int WinMain2(HINSTANCE hInstance, LPSTR lpCmdLine) {
|
||||
|
||||
*deviceManager->getDisplayConfig() = g_displayConfig; // HACK
|
||||
|
||||
{
|
||||
FileSystem *fs = getDefaultFileSystem();
|
||||
uint32_t mask = fs->getLanguageMask();
|
||||
mask &= 0x3fffffff;
|
||||
mask |= 0x80000000; // dx11
|
||||
Specialisation::BlockingChange(mask);
|
||||
}
|
||||
|
||||
// TODO
|
||||
MAIN_Init();
|
||||
|
||||
|
@ -3,6 +3,7 @@ target_sources(dxhr PRIVATE
|
||||
ResolveObject.cpp
|
||||
ResolveReceiver.cpp
|
||||
ResolveSection.cpp
|
||||
Specialisation.cpp
|
||||
|
||||
AnimationSection.cpp
|
||||
CollisionMeshSection.cpp
|
||||
|
40
cdcResource/Specialisation.cpp
Normal file
40
cdcResource/Specialisation.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include "cdcFile/FileHelpers.h"
|
||||
#include "cdcFile/FileSystem.h"
|
||||
#include "cdcLocale/localstr.h"
|
||||
#include "Specialisation.h"
|
||||
|
||||
using namespace cdc;
|
||||
|
||||
uint32_t Specialisation::s_targetMask;
|
||||
uint32_t Specialisation::s_phase = 2;
|
||||
|
||||
void Specialisation::BlockingChange(uint32_t newMask) {
|
||||
StartChange(newMask);
|
||||
while (s_phase != 2)
|
||||
ContinueChange();
|
||||
}
|
||||
|
||||
void Specialisation::StartChange(uint32_t newMask) {
|
||||
FileSystem *fs = getDefaultFileSystem();
|
||||
if (fs->getLanguageMask() != newMask) {
|
||||
s_phase = 0;
|
||||
s_targetMask = newMask;
|
||||
}
|
||||
}
|
||||
|
||||
void Specialisation::ContinueChange() {
|
||||
if (s_phase == 2)
|
||||
return;
|
||||
|
||||
getDefaultFileSystem()->processRequest();
|
||||
if (getDefaultFileSystem()->hasRequests())
|
||||
return;
|
||||
s_phase++;
|
||||
|
||||
if (s_phase == 1) {
|
||||
uint32_t oldMask = getDefaultFileSystem()->getLanguageMask();
|
||||
getDefaultFileSystem()->setLanguageMask(s_targetMask);
|
||||
localstr_reload();
|
||||
// TODO: Resolve::ChangeSpecialisation(oldMask, s_targetMask);
|
||||
}
|
||||
}
|
11
cdcResource/Specialisation.h
Normal file
11
cdcResource/Specialisation.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
struct Specialisation {
|
||||
static void BlockingChange(uint32_t mask);
|
||||
static void StartChange(uint32_t mask);
|
||||
static void ContinueChange();
|
||||
|
||||
static uint32_t s_targetMask;
|
||||
static uint32_t s_phase; // 0, 1 or 2
|
||||
};
|
Loading…
Reference in New Issue
Block a user