Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入版本号检测 修复全屏报错 #5

Merged
merged 8 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,889 changes: 969 additions & 920 deletions assets/launcher-ui/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/launcher-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"npm-run-all2": "^6.2.0",
"sass": "^1.77.8",
"typescript": "~5.4.0",
"vite": "^5.3.1",
"vite": "^5.4.6",
"vue-tsc": "^2.0.21"
}
}
16 changes: 15 additions & 1 deletion assets/launcher-ui/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ interface DisplayMode {
hz: number;
}

interface GameMeta {
game_type: number;
game_name: string;
installed: boolean;
install_path: string;
resource_path: string;
game_module_path: string;
settings_module_path: string;
updater_module_path: string;
game_module_version: string;
game_module_target_version: string;
}

interface Window {
saucer: {
_idc: number;
Expand All @@ -32,6 +45,7 @@ interface Window {
mounted: () => void;
shellExecute: (file: string, args?: string) => void;
detectGameInstall: (gameIndex: number) => Promise<string[]>;
detectGameInstall1: (gameIndex: number) => Promise<GameMeta>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接换掉原来的

readFile: (path: string) => Promise<string | undefined>;
writeFile: (path: string, content: string) => Promise<void>;
uuid: () => Promise<string>;
Expand All @@ -52,7 +66,7 @@ interface Window {
__cb: ((message: string, color: string, timeout: number) => void) | undefined;
},
ctx: {
gamePaths: Ref<string[][]>;
gameInfos: Ref<GameMeta[]>;
},
},
chrome: any;
Expand Down
43 changes: 40 additions & 3 deletions assets/launcher-ui/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import router from './router'
import { launcher } from './modules/launcher';
import { iidx } from './modules/iidx';
import { sdvx } from './modules/sdvx';
import { parseJsonText } from 'typescript';

window.laochan = {
close() {
Expand All @@ -26,6 +27,9 @@ window.laochan = {
async detectGameInstall(game: number) {
return await window.saucer.call<string[]>('detectGameInstall', [game]);
},
async detectGameInstall1(game: number) {
return JSON.parse(await window.saucer.call<string>('detectGameInstall1', [game]));
},
async readFile(path: string) {
const result = await window.saucer.call<string>('readFile', [path]);
if (result === '<NOT EXIST>') {
Expand Down Expand Up @@ -70,7 +74,40 @@ window.laochan = {
},
num: () => {},
ctx: {
gamePaths: ref<string[][]>([[], [], []]),
gameInfos: ref<GameMeta[]>([{
game_type: 0,
game_name: '',
installed: false,
install_path: '',
resource_path: '',
game_module_path: '',
settings_module_path: '',
updater_module_path: '',
game_module_version: '',
game_module_target_version: ''
},{
game_type: 0,
game_name: '',
installed: false,
install_path: '',
resource_path: '',
game_module_path: '',
settings_module_path: '',
updater_module_path: '',
game_module_version: '',
game_module_target_version: ''
},{
game_type: 0,
game_name: '',
installed: false,
install_path: '',
resource_path: '',
game_module_path: '',
settings_module_path: '',
updater_module_path: '',
game_module_version: '',
game_module_target_version: ''
}]),
},
alert: {
__cb: undefined,
Expand All @@ -86,9 +123,9 @@ window.laochan = {

(async () => {
for (let i = 0; i < 3; i++) {
window.laochan.ctx.gamePaths.value[i] = await window.laochan.detectGameInstall(i);
// window.laochan.ctx.gameInfos.value[i] = await window.laochan.detectGameInstall(i);
window.laochan.ctx.gameInfos.value[i] = await window.laochan.detectGameInstall1(i);
}

launcher.loadConfig();
iidx.loadConfig();
sdvx.loadConfig();
Expand Down
4 changes: 2 additions & 2 deletions assets/launcher-ui/src/modules/gitadora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export class GITADORA {
}

installed() {
return !!window.laochan.ctx.gamePaths.value[2].length;
return !!window.laochan.ctx.gameInfos.value[2].installed;
}

get installPath() {
if (!this.installed()) {
return;
}

const [installPath] = window.laochan.ctx.gamePaths.value[2];
const [installPath] = window.laochan.ctx.gameInfos.value[2].install_path;
return installPath;
}

Expand Down
34 changes: 32 additions & 2 deletions assets/launcher-ui/src/modules/iidx.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { ref, type Ref } from "vue";
import { launcher } 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,
Expand Down Expand Up @@ -40,15 +48,15 @@ export class IIDX {
}

installed() {
return !!window.laochan.ctx.gamePaths.value[0].length;
return !!window.laochan.ctx.gameInfos.value[0].installed;
}

get installPath() {
if (!this.installed()) {
return;
}

const [installPath] = window.laochan.ctx.gamePaths.value[0];
const installPath = window.laochan.ctx.gameInfos.value[0].install_path;
return installPath;
}

Expand All @@ -61,6 +69,28 @@ export class IIDX {
return installPath + 'laochan-config.json';
}

checkVersion(): VersionState {
if (!this.installed()) {
return VersionState.Unknown;
}
const installVersion = window.laochan.ctx.gameInfos.value[0].game_module_version;
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)
{
return VersionState.Need2UpdateLauncher;
}
else if (installVersionNum < targetVersionNum)
{
return VersionState.Need2UpdateGame;
}
else
{
return VersionState.Normal
}
}

async resetConfig() {
const { devices } = await window.laochan.getAsioDeviceList();

Expand Down
4 changes: 2 additions & 2 deletions assets/launcher-ui/src/modules/sdvx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export class SDVX {
}

installed() {
return !!window.laochan.ctx.gamePaths.value[1].length;
return !!window.laochan.ctx.gameInfos.value[1].installed;
}

get installPath() {
if (!this.installed()) {
return;
}

const [installPath] = window.laochan.ctx.gamePaths.value[1];
const [installPath] = window.laochan.ctx.gameInfos.value[1].install_path;
return installPath;
}

Expand Down
8 changes: 7 additions & 1 deletion assets/launcher-ui/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ import { gitadora } from '@/modules/gitadora';
</div>
</div>
<div v-if="iidx.installed()" class="options">
<div class="opt" @click="iidx.start">鍚姩</div>
<div v-if="iidx.checkVersion() == 0" class="opt" @click="iidx.start">鍚姩</div>
<div v-if="iidx.checkVersion() == 1" class="tip opt">
璇峰崌绾у惎鍔ㄥ櫒
</div>
<div v-if="iidx.checkVersion() == 2" class="tip opt disable">
璇峰崌绾ф父鎴�
</div>
<RouterLink class="opt" to="/iidx/settings">棰濆璁剧疆</RouterLink>
<div class="opt" @click="iidx.settings">娓告垙璁剧疆</div>
<div class="opt" @click="iidx.updater">鏇存柊鍣�</div>
Expand Down
1 change: 0 additions & 1 deletion assets/launcher-ui/src/views/IIDXSettingView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ function updateResoltion(e: Event) {
if (!iidx.config.value) {
return;
}

resIndex.value = parseInt((e.target as HTMLInputElement).value);
const resolution = displayModes.value[resIndex.value];

Expand Down
10 changes: 6 additions & 4 deletions assets/launcher-ui/src/views/LauncherSettingView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function openPath(path: string) {
}

function pathes() {
return window.laochan.ctx.gamePaths.value;
return window.laochan.ctx.gameInfos.value;
}

function revealToken(e: FocusEvent) {
Expand Down Expand Up @@ -130,10 +130,12 @@ async function save() {
</h2>
<div v-for="name, i in gameNames" class="item">
<h2>{{ name }}</h2>
<div v-if="pathes()[i].length">
<h3>瀹夎璺緞: <a class="path link" @click="openPath(pathes()[i][0])">{{ pathes()[i][0]
<div v-if="pathes()[i].installed">
<h3>瀹夎璺緞: <a class="path link" @click="openPath(pathes()[i].install_path)">{{ pathes()[i].install_path
}}</a></h3>
<h3>璧勬簮璺緞: <a class="path link" @click="openPath(pathes()[i][1])">{{ pathes()[i][1]
<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
}}</a></h3>
</div>
<div v-else>
Expand Down
2 changes: 0 additions & 2 deletions src/client/component/gitadora/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <game/game.hpp>
#include <launcher/launcher.hpp>

#define GITADORA_TARGET_VERSION "U32:J:A:A:2024021300"

namespace gitadora::env
{
const char* get_cmdline()
Expand Down
13 changes: 10 additions & 3 deletions src/client/component/iidx/custom_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ namespace iidx::custom_resolution
{
static auto w = mode() == 1 ?
GetSystemMetrics(SM_CXSCREEN) : std::stoi(game::environment::get_param("IIDX_RESOLTION_W"));

return w;
if (w == 0)//不知道为什么本机分辨率的时候参数会为0 总之在这处理一下
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w = w ? w : GetSystemMetrics(SM_CXSCREEN)

{
return GetSystemMetrics(SM_CXSCREEN);
}
return 1920;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w

}

int height()
{
static auto h = mode() == 1 ?
GetSystemMetrics(SM_CYSCREEN) : std::stoi(game::environment::get_param("IIDX_RESOLTION_H"));
if (h == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

{
return GetSystemMetrics(SM_CYSCREEN);
}

return h;
return 1200;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h

}

namespace
Expand Down
29 changes: 19 additions & 10 deletions src/client/component/iidx/d3d9_proxy/interface_ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ d3d9ex_proxy::d3d9ex_proxy(IDirect3D9Ex* orig)
{
this->m_d3d = orig;

D3DDISPLAYMODE _D3DDISPLAYMODE{};

orig->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &_D3DDISPLAYMODE);

if (_D3DDISPLAYMODE.RefreshRate>=120)
{
has120hz = true;
}

DEVMODE dm{
.dmSize = sizeof(DEVMODE),
.dmDriverExtra = 0,
Expand Down Expand Up @@ -87,26 +96,26 @@ UINT __stdcall d3d9ex_proxy::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format)

HRESULT __stdcall d3d9ex_proxy::EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode)
{
if (iidx::custom_resolution::mode() != 0 && (has120hz || has119hz || has60hz || has59hz))
if (iidx::custom_resolution::mode() != 0 || (has120hz || has119hz || has60hz || has59hz))
{
pMode->Format = Format;
pMode->Width = 1920;
pMode->Height = 1080;
pMode->Width = iidx::custom_resolution::width();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个1920x1080是有原因的 不能改

pMode->Height = iidx::custom_resolution::height();

if (Mode)
return D3DERR_INVALIDCALL;

if (has120hz)
pMode->RefreshRate = 120;

if (has119hz)
pMode->RefreshRate = 119;
if (has59hz)
pMode->RefreshRate = 59;

if (has60hz)
pMode->RefreshRate = 60;

if (has59hz)
pMode->RefreshRate = 59;
if (has119hz)
pMode->RefreshRate = 119;

if (has120hz)
pMode->RefreshRate = 120;

return D3D_OK;
}
Expand Down
2 changes: 0 additions & 2 deletions src/client/component/iidx/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <game/game.hpp>
#include <launcher/launcher.hpp>

#define IIDX_TARGET_VERSION "P2D:J:B:A:2024080500"

namespace iidx::env
{
const char* get_cmdline()
Expand Down
2 changes: 0 additions & 2 deletions src/client/component/sdvx/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <game/game.hpp>
#include <launcher/launcher.hpp>

#define SDVX_TARGET_VERSION "QCV:J:B:A:2024080700"

namespace sdvx::env
{
const char* get_cmdline()
Expand Down
Loading
Loading