Skip to content

Commit

Permalink
add gitadora support, fix iidx always wasapi exclusive issue
Browse files Browse the repository at this point in the history
  • Loading branch information
GEEKiDoS committed Aug 10, 2024
1 parent 6d90702 commit a73c3ca
Show file tree
Hide file tree
Showing 16 changed files with 790 additions and 637 deletions.
Binary file added assets/launcher-ui/src/assets/gitadora.webm
Binary file not shown.
110 changes: 110 additions & 0 deletions assets/launcher-ui/src/modules/gitadora.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { ref, type Ref } from "vue";
import { launcher } from "./launcher";

export interface GITADORAConfig {
}

export class GITADORA {
private _config: Ref<GITADORAConfig | undefined> = ref(undefined);
private _dirty: boolean = false;

get config() {
return this._config;
}

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

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

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

get configPath() {
const installPath = this.installPath;
if (!installPath) {
return;
}

return installPath + 'laochan-config.json';
}

async resetConfig() {
this._config.value = {}
this._dirty = true;
}

async saveConfig() {
const path = this.configPath;
if (!path) {
return;
}

const result = JSON.stringify(this._config.value);
await window.laochan.writeFile(path, result);
this._dirty = false;
}

async loadConfig() {
const path = this.configPath;
if (!path) {
return;
}

const configJson = await window.laochan.readFile(path);

if (configJson) {
this._config.value = JSON.parse(configJson);
}

if (!this._config.value) {
await this.resetConfig();
}

if (this._dirty) {
await this.saveConfig();
}
}

async applyConfig() {
const config = this._config.value;
if (!config) {
return;
}
}

async start() {
await this.loadConfig();
await window.laochan.setGame(2);

await this.applyConfig();
await launcher.applyConfig();

window.laochan.close();
}

async settings() {
const installPath = this.installPath;
if (!installPath) {
return;
}

window.laochan.shellExecute(installPath + '\\launcher\\modules\\settings.exe');
}

async updater() {
const installPath = this.installPath;
if (!installPath) {
return;
}

window.laochan.shellExecute(installPath + '\\launcher\\modules\\updater.exe', '-t DUMMY');
}
};

export const gitadora = new GITADORA();
4 changes: 0 additions & 4 deletions assets/launcher-ui/src/modules/sdvx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export class SDVX {
}
}

openCustomize() {
window.laochan.shellExecute('http://laochan.ugreen.sbs/cp');
}

async start() {
await this.loadConfig();
await window.laochan.setGame(1);
Expand Down
30 changes: 26 additions & 4 deletions assets/launcher-ui/src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { iidx } from '@/modules/iidx';
import { sdvx } from '@/modules/sdvx';
import { gitadora } from '@/modules/gitadora';
</script>

<template>
Expand Down Expand Up @@ -40,11 +41,23 @@ import { sdvx } from '@/modules/sdvx';
<div class="opt small" @click="iidx.generateBat">生成快速启动 BAT</div>
</div>
</div>
<div class="game gitadora disable">
<div class="background"></div>
<div class="game gitadora">
<div class="background">
<video loop autoplay muted src="../assets/gitadora.webm"></video>
</div>
<div class="text">
GITDORA
<div class="tip"><small>COMING S∞N</small></div>
GITADORA <br><br>
<div v-if="!gitadora.installed()" class="tip">
未安装
</div>
<div v-else class="tip">
<small>请注意: 服务器暂不支持</small>
</div>
</div>
<div v-if="gitadora.installed()" class="options">
<div class="opt" @click="gitadora.start">启动</div>
<div class="opt" @click="gitadora.settings">游戏设置</div>
<div class="opt" @click="gitadora.updater">更新器</div>
</div>
</div>
<div></div>
Expand Down Expand Up @@ -170,4 +183,13 @@ main>div {
.game:hover>.background {
filter: brightness(0.65);
}
.gitadora>.background {
opacity: 0.8;
}
.gitadora>.background>video {
position: absolute;
right: -25%;
}
</style>
27 changes: 24 additions & 3 deletions src/client/component/gitadora/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ namespace gitadora::patches
return false;
}

// force exit anti debug thread
void check_remote_debugger_preset(HANDLE, PBOOL preset)
{
ExitThread(0);
}

void* get_proc_address(HMODULE module, const char* name)
{
if (name == "IsDebuggerPresent"s)
return is_debugger_present;

if (name == "CheckRemoteDebuggerPresent"s)
return check_remote_debugger_preset;

if (name == "ExitProcess"s)
return exit;

return GetProcAddress(module, name);
}

const char* __fastcall get_service_url()
{
static auto service_url = ([]
Expand All @@ -41,9 +61,6 @@ namespace gitadora::patches

// change service url
utils::hook::jump(libeacnet.get_ptr() + 0x11EC0, get_service_url, true);

// disable anticheat thread
utils::hook::nop(0x140003AC2, 5);
}

void* load_import(const std::string& library, const std::string& function) override
Expand All @@ -53,6 +70,10 @@ namespace gitadora::patches
{
return is_debugger_present;
}
else if (function == "GetProcAddress")
{
return get_proc_address;
}

return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/component/iidx/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace iidx::env
{
static auto cmdline = ([]
{
auto args = "bm2dx.exe --ex -t "s;
auto args = "bm2dx.exe -t "s;
args += game::environment::get_param("LAOCHAN_TOKEN");

if (game::environment::get_param("IIDX_SOUND_MODE") == "1")
Expand Down
5 changes: 3 additions & 2 deletions src/client/component/iidx/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ namespace iidx::patches

bool generate_music_list(avs2::property_ptr dst_prop, avs2::node_ptr /* dst_node */, avs2::node_ptr /*src_node*/, bool /*deep*/)
{
static const uint8_t zero_buffer[64]{};

auto music_data = iidx::get_music_data();
auto root = avs2::property_node_create(dst_prop, nullptr, avs2::NODE_TYPE_s32, "/music_list", music_data->music_count);
auto root = avs2::property_node_create(dst_prop, nullptr, avs2::NODE_TYPE_node, "/music_list", zero_buffer);

avs2::property_node_create(dst_prop, root, avs2::NODE_TYPE_s32, "music_num", music_data->music_count);

Expand All @@ -97,7 +99,6 @@ namespace iidx::patches
notebit |= 1 << j;
}

static const uint8_t zero_buffer[64]{};
auto* node = avs2::property_node_create(dst_prop, root, avs2::NODE_TYPE_node, "music", zero_buffer);

avs2::property_node_create(dst_prop, node, avs2::NODE_TYPE_s32, "music_id", music.song_id);
Expand Down
2 changes: 1 addition & 1 deletion src/client/launcher/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "component/steam_proxy.hpp"

#define USE_EMBEDDED 1
#define USE_EMBEDDED 0

#if !_DEBUG || USE_EMBEDDED
#include "resources/all.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/client/resource.g.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
#define ID_ASSET_9 359
#define ID_ASSET_10 360
#define ID_ASSET_11 361
#define ID_ASSET_12 362
21 changes: 11 additions & 10 deletions src/client/resource.g.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

ID_ASSET_0 RCDATA "resources/ui-dist/favicon.ico"
ID_ASSET_1 RCDATA "resources/ui-dist/index.html"
ID_ASSET_2 RCDATA "resources/ui-dist/assets/howler-CCqh-U3u.js"
ID_ASSET_3 RCDATA "resources/ui-dist/assets/iidx-BAOXvOlX.jpg"
ID_ASSET_4 RCDATA "resources/ui-dist/assets/index-B-vfAE1K.css"
ID_ASSET_5 RCDATA "resources/ui-dist/assets/index-C_kzkGaT.js"
ID_ASSET_6 RCDATA "resources/ui-dist/assets/moai-bg-BU2gdkgA.jpg"
ID_ASSET_7 RCDATA "resources/ui-dist/assets/msyhsb-CG5zefP1.woff2"
ID_ASSET_8 RCDATA "resources/ui-dist/assets/num-BvRoq2n1.png"
ID_ASSET_9 RCDATA "resources/ui-dist/assets/num-z0VsZKpR.mp3"
ID_ASSET_10 RCDATA "resources/ui-dist/assets/sdvx-BIdRBwi8.jpg"
ID_ASSET_11 RCDATA "resources/ui-dist/assets/sgm-BpMyBNft.woff2"
ID_ASSET_2 RCDATA "resources/ui-dist/assets/gitadora-cQ1BqJ9U.webm"
ID_ASSET_3 RCDATA "resources/ui-dist/assets/howler-CCqh-U3u.js"
ID_ASSET_4 RCDATA "resources/ui-dist/assets/iidx-BAOXvOlX.jpg"
ID_ASSET_5 RCDATA "resources/ui-dist/assets/index-C6Vda7tP.css"
ID_ASSET_6 RCDATA "resources/ui-dist/assets/index-vWtKjMKp.js"
ID_ASSET_7 RCDATA "resources/ui-dist/assets/moai-bg-BU2gdkgA.jpg"
ID_ASSET_8 RCDATA "resources/ui-dist/assets/msyhsb-CG5zefP1.woff2"
ID_ASSET_9 RCDATA "resources/ui-dist/assets/num-BvRoq2n1.png"
ID_ASSET_10 RCDATA "resources/ui-dist/assets/num-z0VsZKpR.mp3"
ID_ASSET_11 RCDATA "resources/ui-dist/assets/sdvx-BIdRBwi8.jpg"
ID_ASSET_12 RCDATA "resources/ui-dist/assets/sgm-BpMyBNft.woff2"
21 changes: 11 additions & 10 deletions src/client/resources/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ namespace laochan::embedded
rtn.emplace("index.html", saucer::embedded_file{"text/html", root});
rtn.emplace("", saucer::embedded_file{"text/html", root});

rtn.emplace("assets/howler-CCqh-U3u.js", saucer::embedded_file{"text/javascript", read_resource(ID_ASSET_2)});
rtn.emplace("assets/iidx-BAOXvOlX.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_3)});
rtn.emplace("assets/index-B-vfAE1K.css", saucer::embedded_file{"text/css", read_resource(ID_ASSET_4)});
rtn.emplace("assets/index-C_kzkGaT.js", saucer::embedded_file{"text/javascript", read_resource(ID_ASSET_5)});
rtn.emplace("assets/moai-bg-BU2gdkgA.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_6)});
rtn.emplace("assets/msyhsb-CG5zefP1.woff2", saucer::embedded_file{"font/woff2", read_resource(ID_ASSET_7)});
rtn.emplace("assets/num-BvRoq2n1.png", saucer::embedded_file{"image/png", read_resource(ID_ASSET_8)});
rtn.emplace("assets/num-z0VsZKpR.mp3", saucer::embedded_file{"audio/mpeg", read_resource(ID_ASSET_9)});
rtn.emplace("assets/sdvx-BIdRBwi8.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_10)});
rtn.emplace("assets/sgm-BpMyBNft.woff2", saucer::embedded_file{"font/woff2", read_resource(ID_ASSET_11)});
rtn.emplace("assets/gitadora-cQ1BqJ9U.webm", saucer::embedded_file{"video/webm", read_resource(ID_ASSET_2)});
rtn.emplace("assets/howler-CCqh-U3u.js", saucer::embedded_file{"text/javascript", read_resource(ID_ASSET_3)});
rtn.emplace("assets/iidx-BAOXvOlX.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_4)});
rtn.emplace("assets/index-C6Vda7tP.css", saucer::embedded_file{"text/css", read_resource(ID_ASSET_5)});
rtn.emplace("assets/index-vWtKjMKp.js", saucer::embedded_file{"text/javascript", read_resource(ID_ASSET_6)});
rtn.emplace("assets/moai-bg-BU2gdkgA.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_7)});
rtn.emplace("assets/msyhsb-CG5zefP1.woff2", saucer::embedded_file{"font/woff2", read_resource(ID_ASSET_8)});
rtn.emplace("assets/num-BvRoq2n1.png", saucer::embedded_file{"image/png", read_resource(ID_ASSET_9)});
rtn.emplace("assets/num-z0VsZKpR.mp3", saucer::embedded_file{"audio/mpeg", read_resource(ID_ASSET_10)});
rtn.emplace("assets/sdvx-BIdRBwi8.jpg", saucer::embedded_file{"image/jpeg", read_resource(ID_ASSET_11)});
rtn.emplace("assets/sgm-BpMyBNft.woff2", saucer::embedded_file{"font/woff2", read_resource(ID_ASSET_12)});

return rtn;
}
Expand Down
Binary file not shown.
Loading

0 comments on commit a73c3ca

Please sign in to comment.