mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-05-10 19:01:53 +00:00
librecomp now builds, it should be a bit broken tho
This commit is contained in:
parent
195a6cacf8
commit
1d26501fe9
3 changed files with 46 additions and 23 deletions
|
|
@ -29,7 +29,15 @@ add_library(librecomp STATIC
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/ultra_translation.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/ultra_translation.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/vi.cpp")
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/vi.cpp")
|
||||||
|
|
||||||
target_include_directories(librecomp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
target_include_directories(librecomp PUBLIC
|
||||||
target_include_directories(librecomp PRIVATE "${CMAKE_SOURCE_DIR}/rt64/src/contrib")
|
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||||
|
"${CMAKE_SOURCE_DIR}/ultramodern/include"
|
||||||
|
"${CMAKE_SOURCE_DIR}/thirdparty/concurrentqueue"
|
||||||
|
)
|
||||||
|
target_include_directories(librecomp PRIVATE
|
||||||
|
"${CMAKE_SOURCE_DIR}/rt64/src/contrib"
|
||||||
|
)
|
||||||
|
|
||||||
target_compile_options(librecomp PRIVATE -Wno-deprecated-declarations)
|
target_compile_options(librecomp PRIVATE -Wno-deprecated-declarations)
|
||||||
|
|
||||||
target_link_libraries(librecomp PRIVATE ultramodern)
|
target_link_libraries(librecomp PRIVATE ultramodern)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ namespace recomp {
|
||||||
void message_box(const char* message);
|
void message_box(const char* message);
|
||||||
std::filesystem::path get_app_folder_path();
|
std::filesystem::path get_app_folder_path();
|
||||||
std::u8string current_game_id();
|
std::u8string current_game_id();
|
||||||
|
|
||||||
|
// TODO: implement both
|
||||||
|
const std::u8string& get_program_id();
|
||||||
|
void set_program_id(const std::u8string& program_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#ifdef _WIN32
|
|
||||||
#include <Windows.h>
|
|
||||||
#endif
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -10,6 +7,14 @@
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <Windows.h>
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "recomp.h"
|
#include "recomp.h"
|
||||||
#include "recomp_overlays.h"
|
#include "recomp_overlays.h"
|
||||||
#include "recomp_game.h"
|
#include "recomp_game.h"
|
||||||
|
|
@ -97,7 +102,7 @@ std::filesystem::path recomp::get_app_folder_path() {
|
||||||
PWSTR known_path = NULL;
|
PWSTR known_path = NULL;
|
||||||
HRESULT result = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &known_path);
|
HRESULT result = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &known_path);
|
||||||
if (result == S_OK) {
|
if (result == S_OK) {
|
||||||
recomp_dir = std::filesystem::path{known_path} / recomp::program_id;
|
recomp_dir = std::filesystem::path{known_path} / recomp::get_program_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoTaskMemFree(known_path);
|
CoTaskMemFree(known_path);
|
||||||
|
|
@ -109,7 +114,7 @@ std::filesystem::path recomp::get_app_folder_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (homedir != nullptr) {
|
if (homedir != nullptr) {
|
||||||
recomp_dir = std::filesystem::path{homedir} / (std::u8string{u8".config/"} + std::u8string{recomp::program_id});
|
recomp_dir = std::filesystem::path{homedir} / (std::u8string{u8".config/"} + recomp::get_program_id());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -447,9 +452,9 @@ void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::a
|
||||||
|
|
||||||
std::thread game_thread{[](ultramodern::WindowHandle window_handle, uint8_t* rdram) {
|
std::thread game_thread{[](ultramodern::WindowHandle window_handle, uint8_t* rdram) {
|
||||||
debug_printf("[Recomp] Starting\n");
|
debug_printf("[Recomp] Starting\n");
|
||||||
|
|
||||||
ultramodern::set_native_thread_name("Game Start Thread");
|
ultramodern::set_native_thread_name("Game Start Thread");
|
||||||
|
|
||||||
ultramodern::preinit(rdram, window_handle);
|
ultramodern::preinit(rdram, window_handle);
|
||||||
|
|
||||||
game_status.wait(GameStatus::None);
|
game_status.wait(GameStatus::None);
|
||||||
|
|
@ -458,25 +463,31 @@ void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::a
|
||||||
switch (game_status.load()) {
|
switch (game_status.load()) {
|
||||||
// TODO refactor this to allow a project to specify what entrypoint function to run for a give game.
|
// TODO refactor this to allow a project to specify what entrypoint function to run for a give game.
|
||||||
case GameStatus::Running:
|
case GameStatus::Running:
|
||||||
if (!recomp::load_stored_rom(current_game.value())) {
|
{
|
||||||
recomp::message_box("Error opening stored ROM! Please restart this program.");
|
if (!recomp::load_stored_rom(current_game.value())) {
|
||||||
|
recomp::message_box("Error opening stored ROM! Please restart this program.");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto find_it = game_roms.find(current_game.value());
|
||||||
|
const recomp::GameEntry& game_entry = find_it->second;
|
||||||
|
|
||||||
|
ultramodern::load_shader_cache(game_entry.cache_data);
|
||||||
|
init(rdram, &context);
|
||||||
|
try {
|
||||||
|
recomp_entrypoint(rdram, &context);
|
||||||
|
} catch (ultramodern::thread_terminated& terminated) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto find_it = game_roms.find(current_game.value());
|
|
||||||
const recomp::GameEntry& game_entry = find_it->second;
|
|
||||||
|
|
||||||
ultramodern::load_shader_cache(game_entry.cache_data);
|
|
||||||
init(rdram, &context);
|
|
||||||
try {
|
|
||||||
recomp_entrypoint(rdram, &context);
|
|
||||||
} catch (ultramodern::thread_terminated& terminated) {
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameStatus::Quit:
|
case GameStatus::Quit:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GameStatus::None:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf("[Recomp] Quitting\n");
|
debug_printf("[Recomp] Quitting\n");
|
||||||
}, window_handle, rdram_buffer.get()};
|
}, window_handle, rdram_buffer.get()};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue