Skip to content

Commit

Permalink
取反disable_ifs_hook 添加wchar支持
Browse files Browse the repository at this point in the history
  • Loading branch information
RERASER committed Sep 19, 2024
1 parent 15d0a26 commit 3081277
Show file tree
Hide file tree
Showing 20 changed files with 343 additions and 259 deletions.
23 changes: 21 additions & 2 deletions assets/launcher-ui/src/modules/gitadora.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref, type Ref } from "vue";
import { launcher } from "./launcher";
import { launcher, VersionState } from "./launcher";

export interface GITADORAConfig {
}
Expand All @@ -15,7 +15,7 @@ export class GITADORA {
installed() {
return !!window.laochan.ctx.gameInfos.value[2].installed;
}

get installPath() {
if (!this.installed()) {
return;
Expand All @@ -34,6 +34,25 @@ export class GITADORA {
return installPath + 'laochan-config.json';
}

checkVersion(): VersionState {
if (!this.installed()) {
return VersionState.Unknown;
}
const installVersion = window.laochan.ctx.gameInfos.value[2].game_module_version;
const targetVersion = window.laochan.ctx.gameInfos.value[2].game_module_target_version;
const installVersionNum = Number.parseInt(installVersion.split(":")[4]);
const targetVersionNum = Number.parseInt(targetVersion.split(":")[4]);
if (installVersionNum > targetVersionNum) {
return VersionState.Need2UpdateLauncher;
}
else if (installVersionNum < targetVersionNum) {
return VersionState.Need2UpdateGame;
}
else {
return VersionState.Normal
}
}

async resetConfig() {
this._config.value = {}
this._dirty = true;
Expand Down
20 changes: 5 additions & 15 deletions assets/launcher-ui/src/modules/iidx.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { ref, type Ref } from "vue";
import { launcher } from "./launcher";
import { launcher, VersionState } from "./launcher";
import dedent from "dedent";
import type { TupleType } from "typescript";

export enum VersionState {
Unknown = -1,
Normal = 0,
Need2UpdateLauncher = 1,
Need2UpdateGame = 2,
}

export enum IIDXDisplayMode {
Fullscreen = 0,
BorderlessWindowed = 1,
Expand Down Expand Up @@ -77,16 +70,13 @@ export class IIDX {
const targetVersion = window.laochan.ctx.gameInfos.value[0].game_module_target_version;
const installVersionNum = Number.parseInt(installVersion.split(":")[4]);
const targetVersionNum = Number.parseInt(targetVersion.split(":")[4]);
if (installVersionNum > targetVersionNum)
{
if (installVersionNum > targetVersionNum) {
return VersionState.Need2UpdateLauncher;
}
else if (installVersionNum < targetVersionNum)
{
}
else if (installVersionNum < targetVersionNum) {
return VersionState.Need2UpdateGame;
}
else
{
else {
return VersionState.Normal
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/launcher-ui/src/modules/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export interface LauncherConfig {
enableSteamOverlay: boolean;
}

export enum VersionState {
Unknown = -1,
Normal = 0,
Need2UpdateLauncher = 1,
Need2UpdateGame = 2,
}

export class Launcher {
private _config: Ref<LauncherConfig | undefined> = ref(undefined);
private _dirty: boolean = false;
Expand Down
23 changes: 21 additions & 2 deletions assets/launcher-ui/src/modules/sdvx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref, type Ref } from "vue";
import { launcher } from "./launcher";
import { launcher, VersionState } from "./launcher";

export interface SDVXConfig {
}
Expand All @@ -15,7 +15,7 @@ export class SDVX {
installed() {
return !!window.laochan.ctx.gameInfos.value[1].installed;
}

get installPath() {
if (!this.installed()) {
return;
Expand All @@ -34,6 +34,25 @@ export class SDVX {
return installPath + 'laochan-config.json';
}

checkVersion(): VersionState {
if (!this.installed()) {
return VersionState.Unknown;
}
const installVersion = window.laochan.ctx.gameInfos.value[1].game_module_version;
const targetVersion = window.laochan.ctx.gameInfos.value[1].game_module_target_version;
const installVersionNum = Number.parseInt(installVersion.split(":")[4]);
const targetVersionNum = Number.parseInt(targetVersion.split(":")[4]);
if (installVersionNum > targetVersionNum) {
return VersionState.Need2UpdateLauncher;
}
else if (installVersionNum < targetVersionNum) {
return VersionState.Need2UpdateGame;
}
else {
return VersionState.Normal
}
}

async resetConfig() {
this._config.value = {}
this._dirty = true;
Expand Down
18 changes: 15 additions & 3 deletions assets/launcher-ui/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ import { gitadora } from '@/modules/gitadora';
</div>
</div>
<div v-if="sdvx.installed()" class="options">
<div class="opt" @click="sdvx.start">启动</div>
<div v-if="sdvx.checkVersion() == 0" class="opt" @click="sdvx.start">启动</div>
<div v-if="sdvx.checkVersion() == 1" class="tip opt">
请升级启动器
</div>
<div v-if="sdvx.checkVersion() == 2" class="tip opt">
请升级游戏
</div>
<div class="opt" @click="sdvx.settings">游戏设置</div>
<div class="opt" @click="sdvx.updater">更新器</div>
</div>
Expand All @@ -36,7 +42,7 @@ import { gitadora } from '@/modules/gitadora';
<div v-if="iidx.checkVersion() == 1" class="tip opt">
请升级启动器
</div>
<div v-if="iidx.checkVersion() == 2" class="tip opt disable">
<div v-if="iidx.checkVersion() == 2" class="tip opt">
请升级游戏
</div>
<RouterLink class="opt" to="/iidx/settings">额外设置</RouterLink>
Expand All @@ -61,7 +67,13 @@ import { gitadora } from '@/modules/gitadora';
</div>
</div>
<div v-if="gitadora.installed()" class="options">
<div class="opt" @click="gitadora.start">启动</div>
<div v-if="gitadora.checkVersion() == 0" class="opt" @click="gitadora.start">启动</div>
<div v-if="gitadora.checkVersion() == 1" class="tip opt">
请升级启动器
</div>
<div v-if="gitadora.checkVersion() == 2" class="tip opt">
请升级游戏
</div>
<div class="opt" @click="gitadora.settings">游戏设置</div>
<div class="opt" @click="gitadora.updater">更新器</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion assets/launcher-ui/src/views/LauncherSettingView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ async function save() {
}}</a></h3>
<h3>资源路径: <a class="path link" @click="openPath(pathes()[i].resource_path)">{{ pathes()[i].resource_path
}}</a></h3>
<h3>游戏版本: <a class="path link" @click="openPath(pathes()[i].game_module_version)">{{ pathes()[i].game_module_version
<h3>游戏版本: <a class="path link">{{ pathes()[i].game_module_version
}}</a></h3>
<h3>支持版本: <a class="path link">{{ pathes()[i].game_module_target_version
}}</a></h3>
</div>
<div v-else>
Expand Down
2 changes: 1 addition & 1 deletion src/client/component/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace filesystem
if (!std::filesystem::exists(data_dir))
printf("warning: data dir %s not exists\n", abs_data_path.data());

if (utils::flags::has_flag("disable_ifs_hook"))
if (!utils::flags::has_flag("disable_ifs_hook"))
init(std::filesystem::exists(data_dir) ? nullptr : abs_data_path.data());

avs2::fs_mount("/laochan", abs_data_path.data(), "fs", const_cast<char*>("vf=1,posix=1"));
Expand Down
8 changes: 4 additions & 4 deletions src/client/component/iidx/d3d9_proxy/interface_ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ HRESULT __stdcall d3d9ex_proxy::EnumAdapterModes(UINT Adapter, D3DFORMAT Format,
if (iidx::custom_resolution::mode() != 0 || (has120hz || has119hz || has60hz || has59hz))
{
pMode->Format = Format;
pMode->Width = iidx::custom_resolution::width();
pMode->Height = iidx::custom_resolution::height();
pMode->Width = 1920;
pMode->Height = 1080;

if (Mode)
return D3DERR_INVALIDCALL;
Expand Down Expand Up @@ -187,8 +187,8 @@ HRESULT __stdcall d3d9ex_proxy::CreateDeviceEx(UINT Adapter, D3DDEVTYPE DeviceTy
{
IDirect3DDevice9Ex* device = nullptr;

pPresentationParameters->BackBufferWidth = 1920;
pPresentationParameters->BackBufferHeight = 1080;
pPresentationParameters->BackBufferWidth = iidx::custom_resolution::width();
pPresentationParameters->BackBufferHeight = iidx::custom_resolution::height();

if (iidx::custom_resolution::mode() != 0)
{
Expand Down
Loading

0 comments on commit 3081277

Please sign in to comment.