mirror of
https://github.com/shadergz/cosmic-station.git
synced 2024-11-23 06:09:40 +00:00
Core: Using libfmt for handling of exceptions messages arguments
This commit is contained in:
parent
37422bf4e5
commit
cf3737e34c
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "app/src/main/cpp/addons/fmt"]
|
||||
path = app/src/main/cpp/addons/fmt
|
||||
url = https://github.com/fmtlib/fmt.git
|
@ -39,8 +39,11 @@ target_sources(zenith PRIVATE
|
||||
${ZENITH_MISC_DIR}/driver_glvk_chk.cpp
|
||||
${ZENITH_MISC_DIR}/jvm_comm.cpp)
|
||||
|
||||
add_subdirectory(${ADDONS_DIR}/fmt EXCLUDE_FROM_ALL)
|
||||
|
||||
target_sources(addons PRIVATE
|
||||
${ADDONS_DIR}/compile_this.cpp)
|
||||
|
||||
target_link_libraries(addons PUBLIC fmt::fmt)
|
||||
target_compile_options(zenith PRIVATE -Wreorder -Wconversion -Wformat-security -Wshadow)
|
||||
target_link_libraries(zenith PRIVATE addons)
|
||||
target_link_libraries(zenith PRIVATE addons fmt::fmt-header-only)
|
||||
|
1
app/src/main/cpp/addons/fmt
Submodule
1
app/src/main/cpp/addons/fmt
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f5e54359df4c26b6230fc61d38aa294581393084
|
@ -10,6 +10,6 @@ namespace zenith {
|
||||
simulatedDevices(std::make_shared<console::VirtualDevices>(virtualBlocks)) {
|
||||
|
||||
auto osState{deviceRes->getServiceState()};
|
||||
osState.lock()->synchronizeAllSettings();
|
||||
osState.lock()->syncAllSettings();
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ namespace zenith::console {
|
||||
|
||||
biosHLE = std::make_unique<kernel::BiosHLE>(mipsEER5900);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <link/managed_glb_memory.h>
|
||||
#include <link/glb_memory.h>
|
||||
#include <eeiv/ee_engine.h>
|
||||
#include <iop/iop_core.h>
|
||||
#include <kernel/hle.h>
|
||||
|
@ -1,9 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
#include <eeiv/mmu_tlb.h>
|
||||
|
||||
namespace zenith::eeiv {
|
||||
static constexpr u8 cop0RegsCount{32};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
|
||||
namespace zenith::eeiv {
|
||||
enum MipsRegsHw : u8 {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <span>
|
||||
|
||||
#include <os/neon_simd.h>
|
||||
#include <link/managed_glb_memory.h>
|
||||
#include <link/glb_memory.h>
|
||||
#include <eeiv/cop0.h>
|
||||
#include <eeiv/high_fast_cache.h>
|
||||
#include <eeiv/mmu_tlb.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
namespace zenith::eeiv {
|
||||
class EEMipsCore;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include <functional>
|
||||
|
||||
#include <eeiv/ee_engine.h>
|
||||
|
||||
namespace zenith::eeiv {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <impltypes.h>
|
||||
|
||||
#include <types.h>
|
||||
namespace zenith::eeiv {
|
||||
struct EECacheLine {
|
||||
u32 tags[2];
|
||||
|
@ -28,7 +28,7 @@ namespace zenith::eeiv {
|
||||
for (auto segmentPage{kUnmapStart}; segmentPage != kUnmapEnd; segmentPage += 4096) {
|
||||
auto kVTable{segmentPage / 4096};
|
||||
if (kVTable >= 1024 * 1024) {
|
||||
throw exception("Kernel TLB table is outside the specified range");
|
||||
throw fatal_error("Kernel TLB table {} is outside the specified range", kVTable);
|
||||
}
|
||||
|
||||
kernelVTLB[kVTable] = choiceMemSrc(segmentPage & (0x20000000 - 1));
|
||||
@ -60,7 +60,7 @@ namespace zenith::eeiv {
|
||||
|
||||
void TLBCache::tlbChModified(u32 page, bool value) {
|
||||
if (page >= 1024 * 1024)
|
||||
throw exception("Page is outside the range, TLB is missing for this page");
|
||||
throw fatal_error("Page {} is outside the range, TLB is missing for this page", page);
|
||||
tlbInfo[page].modified = value;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <impltypes.h>
|
||||
#include <link/managed_glb_memory.h>
|
||||
#include <types.h>
|
||||
#include <link/glb_memory.h>
|
||||
|
||||
// kuseg | 00000000h-7fffffffh | User, TLB-mapped
|
||||
// kseg0 | 80000000h-9fffffffh | Kernel, directly-mapped, cached
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
|
||||
namespace zenith::iop {
|
||||
class IOMipsCore {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
namespace zenith::java {
|
||||
using JNIEnumerator = i32;
|
||||
struct JNIString {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
|
||||
#include <eeiv/ee_engine.h>
|
||||
namespace zenith::kernel {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <android/log.h>
|
||||
#include <vector>
|
||||
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
|
||||
namespace zenith {
|
||||
enum LoggerLevel {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
namespace zenith::os {
|
||||
template<typename T>
|
||||
struct MappedMemory {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <arm_neon.h>
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
namespace zenith::os {
|
||||
using uNative128 = uint64x2_t;
|
||||
|
||||
|
@ -5,7 +5,7 @@ namespace zenith::os {
|
||||
std::string("EE Execution Technique")
|
||||
};
|
||||
|
||||
void OSMachState::synchronizeAllSettings() {
|
||||
void OSMachState::syncAllSettings() {
|
||||
externalDirectory.updateValue();
|
||||
cpuExecutor.updateValue();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <array>
|
||||
|
||||
#include <java/jclasses.h>
|
||||
#include <impltypes.h>
|
||||
#include <types.h>
|
||||
namespace zenith::os {
|
||||
enum StateIDs {
|
||||
appStorageDir,
|
||||
@ -55,7 +55,7 @@ namespace zenith::os {
|
||||
OSMachState(JNIEnv* androidEnv)
|
||||
: externalDirectory(androidEnv, statesIds[StateIDs::appStorageDir]),
|
||||
cpuExecutor(androidEnv, statesIds[StateIDs::eeExecTechnique]) {}
|
||||
void synchronizeAllSettings();
|
||||
void syncAllSettings();
|
||||
// Directory with write permissions selected by the user
|
||||
OSVariable<java::JNIString> externalDirectory;
|
||||
OSVariable<java::JNIEnumerator> cpuExecutor;
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <verify.h>
|
||||
namespace zenith {
|
||||
using u8 = std::uint8_t;
|
||||
@ -14,9 +17,11 @@ namespace zenith {
|
||||
|
||||
using u64 = std::uint64_t;
|
||||
|
||||
class exception : public std::runtime_error {
|
||||
class fatal_error : public std::runtime_error {
|
||||
public:
|
||||
exception(const char* faultMessage) : std::runtime_error(faultMessage) {}
|
||||
template <typename T, typename... Args>
|
||||
fatal_error(const T& format, Args&&... args)
|
||||
: std::runtime_error(fmt::format(fmt::runtime(format), args...)) {}
|
||||
};
|
||||
|
||||
struct ZenFile {
|
||||
@ -35,7 +40,7 @@ namespace zenith {
|
||||
|
||||
void operator=(int fileNativeFd) {
|
||||
if (fileNativeFd == invalidFileDescriptor) {
|
||||
throw exception("Corrupted file descriptor being passed without checking");
|
||||
throw fatal_error("Corrupted file descriptor being passed without checking");
|
||||
}
|
||||
basicFd = fileNativeFd;
|
||||
|
Loading…
Reference in New Issue
Block a user