Starting from version 1.1.4, the project name has been changed to Cosmic

This commit is contained in:
Gabriel Correia 2023-11-18 16:04:30 -03:00
parent 7e9694a119
commit 321646b024
162 changed files with 499 additions and 437 deletions

3
.idea/.gitignore vendored
View File

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -1 +0,0 @@
zenith-emu

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>

View File

@ -1,18 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AmbiguousExpressionInWhenBranchMigration" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ClangTidy" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="ConstantFunctionResult" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IncompleteDestructuring" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JniParameters" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LeakingThis" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotImplementedFunctions" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedGlobalDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedIncludeDirective" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="RedundantNotNullExtensionReceiverOfInline" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="UnusedParameter" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedSymbol" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedValue" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="17" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.20" />
</component>

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
@ -6,11 +7,4 @@
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.2013358778625954" />
</ProjectState>
</option>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

View File

@ -1,23 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitSharedSettings">
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
<list>
<option value="main" />
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp/Vulkan-Headers" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp/glfw" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp/glm" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp/glslang" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/Vulkan-Hpp/tinyxml2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/perfetto" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/range-v3" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/src/main/cpp/addons/range-v3/doc/gh-pages" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -6,16 +6,16 @@ plugins {
}
android {
namespace = "emu.zenith"
namespace = "emu.cosmic"
compileSdk = 34
defaultConfig {
applicationId = "emu.zenith"
applicationId = "emu.cosmic"
minSdk = 31
targetSdk = 34
versionCode = 113
versionName = "1.1.3"
versionCode = 114
versionName = "1.1.4"
ndk {
abiFilters.clear()
abiFilters.add("arm64-v8a")

View File

@ -1,3 +1,3 @@
# These classes and methods are called through JNI and should not be obfuscated in the release build
-keep class emu.zenith.** { *; }
-keep class emu.cosmic.** { *; }

View File

@ -6,7 +6,7 @@
tools:ignore="ScopedStorage" />
<application
android:name=".ZenithApplication"
android:name=".CosmicApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
@ -14,7 +14,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.App.Zenith"
android:theme="@style/Theme.App.Cosmic"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
tools:targetApi="tiramisu">

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.22.1)
project(ZenithEmu LANGUAGES CXX ASM VERSION 1.1.3)
project(CosmicEmu LANGUAGES CXX ASM VERSION "114")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
@ -13,63 +13,61 @@ set(CMAKE_CXX_FLAGS_DEBUG "-glldb -fstack-protector-strong -O0")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-z,noexecstack")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "-s -Wl,--gc-sections")
# zenith: PS2 core emulator native library
add_library(zenith MODULE)
# cosmic: PS2 core emulator native library
add_library(cosmic MODULE)
set(ZENITH_DIR ${CMAKE_SOURCE_DIR}/cpp/zenith)
set(COSMIC_DIR ${CMAKE_SOURCE_DIR}/cpp/cosmic)
set(ADDONS_DIR ${CMAKE_SOURCE_DIR}/cpp/addons)
set(ZENITH_MISC_DIR ${CMAKE_SOURCE_DIR}/cpp)
target_sources(zenith PRIVATE
${ZENITH_DIR}/common/app.cpp
${ZENITH_DIR}/common/logger.cpp
${ZENITH_DIR}/cpu/cyclic32.cpp
${ZENITH_DIR}/cpu/verify_features.cpp
${ZENITH_DIR}/eeiv/ee_engine.cpp
${ZENITH_DIR}/eeiv/ee_flow.cpp
${ZENITH_DIR}/eeiv/ee_iov0.cpp
${ZENITH_DIR}/eeiv/c0/cop_cache.cpp
${ZENITH_DIR}/eeiv/c0/cop0.cpp
${ZENITH_DIR}/eeiv/c0/cop_misc.cpp
${ZENITH_DIR}/eeiv/c0/cop_dma.cpp
${ZENITH_DIR}/eeiv/fu/cop1_fu.cpp
${ZENITH_DIR}/eeiv/timer/ee_timers.cpp
${ZENITH_DIR}/mio/mmu_tlb.cpp
${ZENITH_DIR}/mio/tlb_mapper.cpp
${ZENITH_DIR}/mio/dma_parallel.cpp
${ZENITH_DIR}/mio/blocks.cpp
${ZENITH_DIR}/fuji/mipsiv_full_interpreter.cpp
${ZENITH_DIR}/fuji/iop_interpreter.cpp
${ZENITH_DIR}/fuji/mipsiv_opcodes.cpp
${ZENITH_DIR}/fuji/mipsiv_isa.cpp
${ZENITH_DIR}/fuji/cop_isa.cpp
${ZENITH_DIR}/gs/synth_tables.cpp
${ZENITH_DIR}/gs/synth_engine.cpp
${ZENITH_DIR}/hle/bios_patch.cpp
${ZENITH_DIR}/hle/group_mgr.cpp
${ZENITH_DIR}/hle/bios_class.cpp
${ZENITH_DIR}/hle/syscall_gate.cpp
${ZENITH_DIR}/fs/bios_loader.cpp
${ZENITH_DIR}/iop/iop_core.cpp
${ZENITH_DIR}/iop/iop_cop.cpp
${ZENITH_DIR}/iop/iop_intc.cpp
${ZENITH_DIR}/gpu/hw_render.cpp
${ZENITH_DIR}/gpu/render_driver.cpp
${ZENITH_DIR}/gpu/exhibition_engine.cpp
${ZENITH_DIR}/os/system_state.cpp
${ZENITH_DIR}/java/device_handler.cpp
${ZENITH_DIR}/java/jclasses.cpp
${ZENITH_DIR}/console/virt_devices.cpp
${ZENITH_DIR}/console/emu_vm.cpp
${ZENITH_DIR}/console/emu_thread.cpp
${ZENITH_DIR}/console/sched_logical.cpp
${ZENITH_DIR}/console/intc.cpp
${ZENITH_DIR}/console/backdoor.cpp
${ZENITH_MISC_DIR}/jvm_comm.cpp
${ZENITH_MISC_DIR}/drivers_glvk_jni.cpp
${ZENITH_MISC_DIR}/bios_jni.cpp
set(COSMIC_MISC_DIR ${CMAKE_SOURCE_DIR}/cpp)
target_sources(cosmic PRIVATE
${COSMIC_DIR}/common/app.cpp
${COSMIC_DIR}/common/logger.cpp
${COSMIC_DIR}/cpu/cyclic32.cpp
${COSMIC_DIR}/cpu/verify_features.cpp
${COSMIC_DIR}/eeiv/ee_engine.cpp
${COSMIC_DIR}/eeiv/ee_flow.cpp
${COSMIC_DIR}/eeiv/ee_iov0.cpp
${COSMIC_DIR}/eeiv/c0/cop_cache.cpp
${COSMIC_DIR}/eeiv/c0/cop0.cpp
${COSMIC_DIR}/eeiv/c0/cop_misc.cpp
${COSMIC_DIR}/eeiv/c0/cop_dma.cpp
${COSMIC_DIR}/eeiv/fu/cop1_fu.cpp
${COSMIC_DIR}/eeiv/timer/ee_timers.cpp
${COSMIC_DIR}/mio/mmu_tlb.cpp
${COSMIC_DIR}/mio/tlb_mapper.cpp
${COSMIC_DIR}/mio/dma_parallel.cpp
${COSMIC_DIR}/mio/blocks.cpp
${COSMIC_DIR}/fuji/mipsiv_full_interpreter.cpp
${COSMIC_DIR}/fuji/iop_interpreter.cpp
${COSMIC_DIR}/fuji/mipsiv_opcodes.cpp
${COSMIC_DIR}/fuji/mipsiv_isa.cpp
${COSMIC_DIR}/fuji/cop_isa.cpp
${COSMIC_DIR}/gs/synth_tables.cpp
${COSMIC_DIR}/gs/synth_engine.cpp
${COSMIC_DIR}/hle/bios_patch.cpp
${COSMIC_DIR}/hle/group_mgr.cpp
${COSMIC_DIR}/hle/bios_class.cpp
${COSMIC_DIR}/hle/syscall_gate.cpp
${COSMIC_DIR}/fs/bios_loader.cpp
${COSMIC_DIR}/iop/iop_core.cpp
${COSMIC_DIR}/iop/iop_cop.cpp
${COSMIC_DIR}/iop/iop_intc.cpp
${COSMIC_DIR}/gpu/hw_render.cpp
${COSMIC_DIR}/gpu/render_driver.cpp
${COSMIC_DIR}/gpu/exhibition_engine.cpp
${COSMIC_DIR}/os/system_state.cpp
${COSMIC_DIR}/java/device_handler.cpp
${COSMIC_DIR}/java/jclasses.cpp
${COSMIC_DIR}/console/virt_devices.cpp
${COSMIC_DIR}/console/emu_vm.cpp
${COSMIC_DIR}/console/emu_thread.cpp
${COSMIC_DIR}/console/sched_logical.cpp
${COSMIC_DIR}/console/intc.cpp
${COSMIC_DIR}/console/backdoor.cpp
${COSMIC_MISC_DIR}/jvm_comm.cpp
${COSMIC_MISC_DIR}/drivers_glvk_jni.cpp
${COSMIC_MISC_DIR}/bios_jni.cpp
${ADDONS_DIR}/compile_this.cpp)
add_subdirectory("${ADDONS_DIR}/fmt" EXCLUDE_FROM_ALL)
add_subdirectory("${ADDONS_DIR}/range-v3")
@ -85,8 +83,7 @@ include_directories(SYSTEM "${ADDONS_DIR}/Vulkan-Hpp/Vulkan-Headers/include")
# Define a static library for Perfetto
add_library(perfetto STATIC ${ADDONS_DIR}/perfetto/sdk/perfetto.cc)
target_include_directories(zenith PRIVATE ${ZENITH_MISC_DIR} ${ZENITH_DIR}
${ADDONS_DIR}/perfetto/sdk)
target_include_directories(cosmic PRIVATE ${COSMIC_MISC_DIR} ${COSMIC_DIR} ${ADDONS_DIR}/perfetto/sdk)
target_link_libraries(zenith PRIVATE log android nativehelper nativewindow EGL fmt::fmt perfetto range-v3::range-v3)
target_compile_options(zenith PRIVATE -Wreorder -Wconversion -Wformat-security -Wshadow)
target_link_libraries(cosmic PRIVATE log android nativehelper nativewindow EGL fmt::fmt perfetto range-v3::range-v3)
target_compile_options(cosmic PRIVATE -Wreorder -Wconversion -Wformat-security -Wshadow)

View File

@ -1,19 +1,19 @@
#include <jni.h>
#include <android/file_descriptor_jni.h>
#include <zenith/common/global.h>
#include <zenith/hle/group_mgr.h>
#include <cosmic/common/global.h>
#include <cosmic/hle/group_mgr.h>
extern "C"
JNIEXPORT jobject JNICALL
Java_emu_zenith_helpers_BiosHelperModel_00024Companion_addBios(JNIEnv* env, jobject thiz, jobject descriptor, jint position) {
zenith::hle::BiosInfo info{env};
Java_emu_cosmic_helpers_BiosHelperModel_00024Companion_addBios(JNIEnv* env, jobject thiz, jobject descriptor, jint position) {
cosmic::hle::BiosInfo info{env};
info.position = position;
auto biosHld{AFileDescriptor_getFd(env, descriptor)};
auto biosMgr{zenith::zenithApp->getBiosMgr()};
auto biosMgr{cosmic::app->getBiosMgr()};
auto object{info.createInstance()};
zenith::i32 find[2]{biosHld, 0};
cosmic::i32 find[2]{biosHld, 0};
if (biosMgr->isAlreadyAdded(find)) {
biosMgr->loadBiosBy(object, find, false);
@ -27,19 +27,19 @@ Java_emu_zenith_helpers_BiosHelperModel_00024Companion_addBios(JNIEnv* env, jobj
}
extern "C"
JNIEXPORT jint JNICALL
Java_emu_zenith_helpers_BiosHelperModel_00024Companion_setBios(JNIEnv* env, jobject thiz, jint pos) {
auto group{zenith::zenithApp->getBiosMgr()};
zenith::i32 by[2]{0, pos};
Java_emu_cosmic_helpers_BiosHelperModel_00024Companion_setBios(JNIEnv* env, jobject thiz, jint pos) {
auto group{cosmic::app->getBiosMgr()};
cosmic::i32 by[2]{0, pos};
return group->choice(by, true);
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_emu_zenith_helpers_BiosHelperModel_00024Companion_removeBios(JNIEnv* env, jobject thiz, jintArray posFd) {
Java_emu_cosmic_helpers_BiosHelperModel_00024Companion_removeBios(JNIEnv* env, jobject thiz, jintArray posFd) {
if (env->GetArrayLength(posFd) != 2) {
throw zenith::AppFail("Not supported element array of size {} passed",
throw cosmic::AppFail("Not supported element array of size {} passed",
env->GetArrayLength(posFd));
}
auto group{zenith::zenithApp->getBiosMgr()};
auto group{cosmic::app->getBiosMgr()};
jint* mangled{env->GetIntArrayElements(posFd, nullptr)};
@ -50,14 +50,14 @@ Java_emu_zenith_helpers_BiosHelperModel_00024Companion_removeBios(JNIEnv* env, j
}
extern "C"
JNIEXPORT void JNICALL
Java_emu_zenith_helpers_BiosHelperModel_00024Companion_cleanAllBios(JNIEnv* env, jobject thiz) {
auto bgp{zenith::zenithApp->getBiosMgr()};
Java_emu_cosmic_helpers_BiosHelperModel_00024Companion_cleanAllBios(JNIEnv* env, jobject thiz) {
auto bgp{cosmic::app->getBiosMgr()};
bgp->discardAll();
}
extern "C"
JNIEXPORT jint JNICALL
Java_emu_zenith_helpers_BiosHelperModel_00024Companion_getBios(JNIEnv* env, jobject thiz, jint defaultPos) {
auto biosGroup{zenith::zenithApp->getBiosMgr()};
Java_emu_cosmic_helpers_BiosHelperModel_00024Companion_getBios(JNIEnv* env, jobject thiz, jint defaultPos) {
auto biosGroup{cosmic::app->getBiosMgr()};
if (biosGroup->slotBios)
return biosGroup->slotBios->position;
return defaultPos;

View File

@ -2,7 +2,7 @@
#include <arm_neon.h>
#include <unistd.h>
namespace zenith {
namespace cosmic {
using i8 = std::int8_t;
using u8 = std::uint8_t;
using u16 = std::uint16_t;

View File

@ -7,10 +7,10 @@
#include <common/global.h>
#include <common/except.h>
namespace zenith {
namespace cosmic {
std::unique_ptr<java::JvmManager> device;
std::shared_ptr<GlobalLogger> userLog;
std::shared_ptr<CoreApplication> zenithApp;
std::shared_ptr<CoreApplication> app;
CoreApplication::CoreApplication()
: simulated(std::make_shared<console::VirtDevices>()) {

View File

@ -8,7 +8,7 @@
#include <hle/group_mgr.h>
#include <gpu/exhibition_engine.h>
namespace zenith {
namespace cosmic {
class CoreApplication {
public:
CoreApplication();

View File

@ -3,7 +3,7 @@
#include <exception>
#include <string>
#include <fmt/format.h>
namespace zenith {
namespace cosmic {
class FatalError : public std::runtime_error {
protected:
template <typename T, typename... Args>
@ -29,7 +29,7 @@ namespace zenith {
DeclareExceptionType(IOFail, "IO");
DeclareExceptionType(FSFail, "FS");
DeclareExceptionType(GPUFail, "GPU");
DeclareExceptionType(AppFail, "Zenith");
DeclareExceptionType(AppFail, "Cosmic");
#undef DeclareExceptionType

View File

@ -4,8 +4,8 @@
#include <common/app.h>
#include <common/logger.h>
namespace zenith {
namespace cosmic {
extern std::unique_ptr<java::JvmManager> device;
extern std::shared_ptr<GlobalLogger> userLog;
extern std::shared_ptr<CoreApplication> zenithApp;
extern std::shared_ptr<CoreApplication> app;
}

View File

@ -11,7 +11,7 @@ PERFETTO_DEFINE_CATEGORIES(
// static in the binary sections
PERFETTO_TRACK_EVENT_STATIC_STORAGE();
namespace zenith {
namespace cosmic {
thread_local fmt::memory_buffer out;
std::string GlobalLogger::prodPrefix(const LoggerLevel ml) {

View File

@ -4,7 +4,7 @@
#include <android/log.h>
#include <common/types.h>
namespace zenith {
namespace cosmic {
enum LoggerLevel {
Info = ANDROID_LOG_INFO,
Debug = ANDROID_LOG_DEBUG,
@ -52,6 +52,6 @@ namespace zenith {
// Don't allow these specific levels to be threaded or printed to the user
std::array<u8, 4> disableLevels{};
static constexpr auto tag{"Zenith"};
static constexpr auto tag{"Cosmic"};
};
}

View File

@ -8,7 +8,7 @@
#include <common/except.h>
#include <common/alias.h>
namespace zenith {
namespace cosmic {
template <typename T>
class raw_reference {
public:

View File

@ -1,10 +1,10 @@
#include <console/backdoor.h>
namespace zenith {
namespace cosmic {
std::shared_ptr<console::RedPillow> redBox;
}
namespace zenith::console {
namespace cosmic::console {
RedPillow::RedPillow(EmuVM& aliveVm) {
vm = std::make_unique<raw_reference<EmuVM>>(std::ref(aliveVm));
mutual = std::unique_lock<std::mutex>();

View File

@ -4,7 +4,7 @@
#include <thread>
#include <mutex>
namespace zenith::console {
namespace cosmic::console {
class EmuVM;
class RedPillow {
@ -22,7 +22,7 @@ namespace zenith::console {
};
}
namespace zenith {
namespace cosmic {
extern std::shared_ptr<console::RedPillow> redBox;
}

View File

@ -5,7 +5,7 @@
#include <console/emu_thread.h>
#include <console/emu_vm.h>
namespace zenith::console {
namespace cosmic::console {
static std::mutex mlMutex;
static std::condition_variable mlCond;
std::atomic<bool> isRunning;

View File

@ -1,7 +1,7 @@
#pragma once
#include <thread>
namespace zenith::console {
namespace cosmic::console {
class EmuVM;
class EmuThread {

View File

@ -6,7 +6,7 @@
#include <eeiv/ee_info.h>
#define TestBiosAccess 0
namespace zenith::console {
namespace cosmic::console {
EmuVM::EmuVM(JNIEnv* env,
std::shared_ptr<VirtDevices>& devices,
std::shared_ptr<gpu::ExhibitionEngine>& dsp)
@ -68,7 +68,7 @@ namespace zenith::console {
ori = hle::SysIop;
if (ori == hle::SysEmotionEngine) {
i16 eeSystem{*mips->gprAt<i16*>(eeiv::$v1)};
i16 eeSystem{*mips->gprAt<i16>(eeiv::$v1)};
dealer.doSyscall(ori, eeSystem);
mips->cop0.cause.exCode = 0;
} else {

View File

@ -10,7 +10,7 @@
#include <console/emu_thread.h>
#include <console/sched_logical.h>
#include <console/intc.h>
namespace zenith::console {
namespace cosmic::console {
class EmuVM {
public:
EmuVM(JNIEnv* env,

View File

@ -1,6 +1,6 @@
#include <console/intc.h>
#include <console/emu_vm.h>
namespace zenith::console {
namespace cosmic::console {
INTCInfra::INTCInfra(EmuVM& vm)
: iopInt(vm.iop) {
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <iop/iop_intc.h>
namespace zenith::console {
namespace cosmic::console {
enum INTControllers {
IopInt
};

View File

@ -1,5 +1,5 @@
#include <console/sched_logical.h>
namespace zenith::console {
namespace cosmic::console {
void Scheduler::runEvents() {
if (eeCycles.cycles < nextEventCycle)
return;

View File

@ -2,7 +2,7 @@
#include <vector>
#include <common/types.h>
namespace zenith::console {
namespace cosmic::console {
using TimerInvokable = std::function<void(u8)>;
enum AffinityControl {
EmotionEngine = 0x3,

View File

@ -1,6 +1,6 @@
#include <console/virt_devices.h>
namespace zenith::console {
namespace cosmic::console {
VirtDevices::VirtDevices() {
virtBlocks = std::make_shared<mio::GlobalMemory>();
controller = std::make_shared<mio::DMAController>();

View File

@ -5,7 +5,7 @@
#include <eeiv/ee_engine.h>
#include <iop/iop_core.h>
namespace zenith::console {
namespace cosmic::console {
class VirtDevices {
public:
VirtDevices();

View File

@ -2,7 +2,7 @@
#include <cpu/cyclic32.h>
namespace zenith::cpu {
namespace cosmic::cpu {
u32 check32(std::span<u8> chkData) {
u32 crc{0xFFFFFFFF};
u64 last{chkData.size()};

View File

@ -3,6 +3,6 @@
#include <span>
#include <common/types.h>
namespace zenith::cpu {
namespace cosmic::cpu {
u32 check32(std::span<u8> chkData);
}

View File

@ -1,6 +1,6 @@
#include <cpu/verify_features.h>
namespace zenith::cpu {
namespace cosmic::cpu {
const std::array<FeaturesImpl, ISA64::size> features{
{{true, "crc32cb,crc32ch,crc32cw,crc32cx"}}
};

View File

@ -5,7 +5,7 @@
#include <array>
#include <common/types.h>
namespace zenith::cpu {
namespace cosmic::cpu {
struct FeaturesImpl {
bool isArchOptional;
std::string family;

View File

@ -1,7 +1,7 @@
#include <arm_neon.h>
#include <eeiv/c0/cop0.h>
namespace zenith::eeiv::c0 {
namespace cosmic::eeiv::c0 {
CoProcessor0::CoProcessor0(std::shared_ptr<mio::DMAController>& ctrl)
: dmac(ctrl) {
// Signals to the BIOS that the EE is in its boot process, so it will start our registers

View File

@ -4,11 +4,11 @@
#include <mio/mmu_tlb.h>
#include <mio/dma_parallel.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
class EEMipsCore;
}
namespace zenith::eeiv::c0 {
namespace cosmic::eeiv::c0 {
static constexpr u8 cop0RegsCount{32};
struct alignas(8) CopCacheLine {
std::array<u32, 2> tags;

View File

@ -2,7 +2,7 @@
#include <eeiv/c0/cop0.h>
#include <eeiv/ee_engine.h>
namespace zenith::eeiv::c0 {
namespace cosmic::eeiv::c0 {
// TODO: Cache indexes use PFN (Physical Frame Number) addressing; we need to redo this entire method
void CoProcessor0::invIndexed(u32 address) {
auto line{viewLine(address)};

View File

@ -1,6 +1,6 @@
#include <eeiv/c0/cop0.h>
namespace zenith::eeiv::c0 {
namespace cosmic::eeiv::c0 {
bool CoProcessor0::getCondition() {
u32 stat{dmac->performRead(0x1000e010) & 0x3ff};
u32 pcr{dmac->performRead(0x1000e020) & 0x3ff};

View File

@ -1,6 +1,6 @@
#include <eeiv/c0/cop0.h>
#include <mio/mmu_tlb.h>
namespace zenith::eeiv::c0 {
namespace cosmic::eeiv::c0 {
// Due to the peculiarities of the implementation, the calling function of setTLB
// must map and unmap the TLB on its own
void CoProcessor0::setTLB(mio::TLBPageEntry& entry) {

View File

@ -2,7 +2,7 @@
#include <common/types.h>
#include <eeiv/ee_info.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
struct EECoreAssembler {
// https://usermanual.wiki/Pdf/EECoreInstructionSetManual.986088270/help
constexpr static u32 lui(const MipsRegsHw dest, u32 imm) {

View File

@ -5,7 +5,7 @@
#include <fuji/mipsiv_interpreter.h>
#include <tokyo3/tokyo3_arm64_jitter.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
EEMipsCore::EEMipsCore(std::shared_ptr<mio::DMAController>& dma)
: cop0(dma),
memory(dma->memoryChips),

View File

@ -12,7 +12,7 @@
#include <eeiv/c0/cop0.h>
#include <eeiv/fu/cop1_fu.h>
#include <eeiv/timer/ee_timers.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
enum class EEExecutionMode : u8 {
// JIT compiler, the fastest option but with various interpretation issues
JitRe,
@ -50,7 +50,7 @@ namespace zenith::eeiv {
}
template <typename T>
inline auto gprAt(u32 index) {
return reinterpret_cast<T>(GPRs[index].words[0]);
return reinterpret_cast<T*>(&GPRs[index].words[0]);
}
inline void chPC(u32 newPC) {
lastPC = eePC;

View File

@ -1,6 +1,6 @@
#include <eeiv/ee_engine.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion"
void EEMipsCore::branchByCondition(bool cond, i32 jumpRel) {

View File

@ -1,7 +1,7 @@
#pragma once
#include <common/types.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
class EEPC {
public:
EEPC() = default;

View File

@ -1,7 +1,7 @@
#pragma once
#include <common/types.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
class EEMipsCore;
class EEExecutor {

View File

@ -1,6 +1,6 @@
#pragma once
namespace zenith::eeiv {
namespace cosmic::eeiv {
enum MipsRegsHw : u8 {
$zero, // Hardwired 0 into the semiconductor
$at,
@ -17,7 +17,7 @@ namespace zenith::eeiv {
};
}
namespace zenith::fuji {
namespace cosmic::fuji {
enum MipsIVOpcodes : u16 {
SpecialOpcodes = 0x0,
Cop0Mfc = 0x0,

View File

@ -1,5 +1,5 @@
#include <eeiv/ee_engine.h>
namespace zenith::eeiv {
namespace cosmic::eeiv {
u32 EEMipsCore::writeArray(u32 address, std::span<u32> dataBlk) {
u32 count{};
for (const auto value : dataBlk) {

View File

@ -1,6 +1,6 @@
#include <eeiv/fu/cop1_fu.h>
namespace zenith::eeiv::fu {
namespace cosmic::eeiv::fu {
CoProcessor1::CoProcessor1() {
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <common/types.h>
namespace zenith::eeiv::fu {
namespace cosmic::eeiv::fu {
class CoProcessor1 {
public:
CoProcessor1();

View File

@ -2,7 +2,7 @@
#include <eeiv/timer/ee_timers.h>
#include <console/sched_logical.h>
namespace zenith::eeiv::timer {
namespace cosmic::eeiv::timer {
EETimers::EETimers() {}
void EETimers::resetTimers() {

View File

@ -1,10 +1,10 @@
#pragma once
#include <common/types.h>
namespace zenith::console {
namespace cosmic::console {
class Scheduler;
}
namespace zenith::eeiv::timer {
namespace cosmic::eeiv::timer {
struct EEHwTimer {
u32 clocks;
bool isEnabled;

View File

@ -8,7 +8,7 @@
#include <common/logger.h>
#include <common/except.h>
namespace zenith::fs {
namespace cosmic::fs {
static const std::map<char, const std::string> countries{
{'A', "USA"},
{'J', "Japan"},

View File

@ -6,7 +6,7 @@
#include <hle/bios_class.h>
#include <os/mapped.h>
namespace zenith::fs {
namespace cosmic::fs {
#pragma pack(push, 1)
struct RomEntry {
std::array<u8, 10> entity;

View File

@ -2,7 +2,7 @@
// This file is protected by the MIT license (please refer to LICENSE.md before making any changes, copying, or redistributing this software)
#include <fuji/mipsiv_interpreter.h>
#include <eeiv/ee_engine.h>
namespace zenith::fuji {
namespace cosmic::fuji {
IvFujiSuperAsm(tlbr) {
auto entry{mainMips.fetchTLBFromCop(mainMips.cop0.GPRs.data())};
mainMips.cop0.loadGPRTLB(std::ref(*entry));
@ -10,12 +10,12 @@ namespace zenith::fuji {
IvFujiSuperAsm(c0mfc) {
u32 res{};
res = mainMips.cop0.mfc0(mainMips.GPRs[ops.fir].bytes[0]);
*(mainMips.gprAt<u32*>(ops.sec)) = res;
*(mainMips.gprAt<u32>(ops.sec)) = res;
}
IvFujiSuperAsm(c0mtc) {
std::array<u32*, 2> c0mop{};
c0mop[0] = mainMips.gprAt<u32*>(ops.fir);
c0mop[1] = mainMips.gprAt<u32*>(ops.sec);
c0mop[0] = mainMips.gprAt<u32>(ops.fir);
c0mop[1] = mainMips.gprAt<u32>(ops.sec);
if (*c0mop[0] != 14 && *c0mop[0] != 30)
;

View File

@ -3,7 +3,7 @@
#define IvFujiOp(op)\
void op(Operands ops)
namespace zenith::fuji {
namespace cosmic::fuji {
constexpr u8 first{0};
constexpr u8 second{1};
constexpr u8 third{2};

View File

@ -6,7 +6,7 @@
op(Operands(opcode, opeRegs));\
break
namespace zenith::fuji {
namespace cosmic::fuji {
IvFujiIopAsm(mfhi) {
u32 target{ioMips.IOGPRs[ops.fir]};
ioMips.IOGPRs[target] = ioMips.hi;

View File

@ -4,7 +4,7 @@
#include <fuji/fuji_common.h>
#define IvFujiIopAsm(op) IvFujiOp(IOPInterpreter::op)
namespace zenith::fuji {
namespace cosmic::fuji {
enum IOPOpcodes {
SpecialOp = 0x0,
CopMfc = 0x0,

View File

@ -2,7 +2,7 @@
// This file is protected by the MIT license (please refer to LICENSE.md before making any changes, copying, or redistributing this software)
#include <fuji/mipsiv_interpreter.h>
#include <eeiv/ee_engine.h>
namespace zenith::fuji {
namespace cosmic::fuji {
static constexpr auto cleanPcBlock{(static_cast<u32>(-1) ^ (MipsIVInterpreter::superBlockCount * 4 - 1))};
void MipsIVInterpreter::performOp(InvokeOpInfo& func, bool deduceCycles) {
if (func.execute) {

View File

@ -9,7 +9,7 @@
#define IvFujiSuperAsm(op) IvFujiOp(MipsIVInterpreter::op)
namespace zenith::fuji {
namespace cosmic::fuji {
struct OutOfOrder {
enum EffectivePipeline {
InvalidOne = 0,

View File

@ -3,7 +3,7 @@
#include <eeiv/ee_assembler.h>
#include <console/backdoor.h>
#include <console/emu_vm.h>
namespace zenith::fuji {
namespace cosmic::fuji {
IvFujiSuperAsm(addi) {
mainMips.GPRs[ops.sec].words[0] = ops.operation.pa16[0] +
mainMips.GPRs[ops.thi].words[0];
@ -22,7 +22,7 @@ namespace zenith::fuji {
// With the 18-bit signed instruction offset, the conditional branch range is ± 128 KBytes
i32 jump{static_cast<i32>(ops.operation.pa16[0] << 2)};
// GPR[31] ← PC + 8
*(mainMips.gprAt<u32*>(eeiv::$ra)) = *mainMips.lastPC + 8;
*mainMips.gprAt<u32>(eeiv::$ra) = *mainMips.lastPC + 8;
mainMips.branchByCondition(mainMips.GPRs[ops.thi].dw[0] < 0, jump);
}
IvFujiSuperAsm(bgez) {

View File

@ -7,7 +7,7 @@
};\
break
namespace zenith::fuji {
namespace cosmic::fuji {
u32 MipsIVInterpreter::decMipsIvS(u32 opcode, InvokeOpInfo& decode) {
switch (opcode & 0x3f) {
case EeSpecialSyscall: SWCached(syscall);

View File

@ -1,7 +1,7 @@
#include <gpu/exhibition_engine.h>
#include <common/except.h>
namespace zenith::gpu {
namespace cosmic::gpu {
ExhibitionEngine::ExhibitionEngine() {
}

View File

@ -4,7 +4,7 @@
#include <android/native_window_jni.h>
#include <gpu/violet/layer.h>
namespace zenith::gpu {
namespace cosmic::gpu {
class ExhibitionEngine {
public:
ExhibitionEngine();

View File

@ -1,7 +1,7 @@
#include <gpu/hw_render.h>
#include <common/global.h>
namespace zenith::gpu {
namespace cosmic::gpu {
RenderScene::RenderScene() {
device->getStates()->customDriver.observer = [this]() {
pickUserRender(true);

View File

@ -2,7 +2,7 @@
#include <common/types.h>
#include <gpu/render_driver.h>
namespace zenith::gpu {
namespace cosmic::gpu {
enum RenderApi : u8 {
HardwareVulkan,
HardwareOpenGL

View File

@ -4,7 +4,7 @@
#include <common/global.h>
#include <common/except.h>
#include <gpu/render_driver.h>
namespace zenith::gpu {
namespace cosmic::gpu {
bool RenderDriver::loadVulkanDriver() {
auto serviceDriver{*(device->getStates()->customDriver)};
auto appStorage{*(device->getStates()->appStorage)};

View File

@ -2,7 +2,7 @@
#include <common/types.h>
#include <gpu/violet/vk_render.h>
namespace zenith::gpu {
namespace cosmic::gpu {
using LinkableObject = void*;
class RenderDriver {

View File

@ -3,7 +3,7 @@
#include <functional>
#include <jni.h>
namespace zenith::gpu::violet {
namespace cosmic::gpu::violet {
class VioletPayload {
public:
std::function<void(jobject)> glvkSetSurface;

View File

@ -2,7 +2,7 @@
#include <EGL/egl.h>
namespace zenith::gpu::violet {
namespace cosmic::gpu::violet {
struct Gl3Render {
EGLSurface surface;
};

View File

@ -5,7 +5,7 @@
#include <gpu/violet/function_payload.h>
#include <gpu/violet/vk_render.h>
#include <gpu/violet/gl3_render.h>
namespace zenith::gpu::violet {
namespace cosmic::gpu::violet {
class VioletLayer : public VioletPayload {
public:
VioletLayer() = default;

View File

@ -3,7 +3,7 @@
#include <optional>
#include <vulkan/vulkan_raii.hpp>
namespace zenith::gpu::violet {
namespace cosmic::gpu::violet {
struct VkRender {
VkRender() {}
std::optional<vk::raii::SurfaceKHR> surface;

View File

@ -1,6 +1,6 @@
#include <gs/synth_engine.h>
namespace zenith::gs {
namespace cosmic::gs {
void GSEngine::resetGraphics() {
}

View File

@ -1,6 +1,6 @@
#pragma once
namespace zenith::gs {
namespace cosmic::gs {
class [[maybe_unused]] GSEngine {
public:
void resetGraphics();

View File

@ -3,7 +3,7 @@
// All these tables and addresses were taken from the PCSX2 project in `GS/GSTables.cpp` on 10/16/2023,
// all rights reserved to the project and its maintainers
namespace zenith::gs {
namespace cosmic::gs {
const u8 blockTable32[4][8]{
{0, 1, 4, 5, 16, 17, 20, 21},
{2, 3, 6, 7, 18, 19, 22, 23},

View File

@ -2,7 +2,7 @@
#include <common/types.h>
namespace zenith::gs {
namespace cosmic::gs {
// After some years of development, the Z mapping tables have been removed,
// with the commit message stating, "They aren't just an offset of the base value
// like the color formats, but instead an XOR of the associated color format"

View File

@ -1,6 +1,6 @@
#include <hle/bios_class.h>
namespace zenith::hle {
namespace cosmic::hle {
jobject BiosInfo::createInstance() {
auto ioClass{findClass()};

View File

@ -3,11 +3,11 @@
#include <common/types.h>
#include <java/jclasses.h>
namespace zenith::hle {
namespace cosmic::hle {
class BiosInfo : java::JavaClass {
public:
BiosInfo(JNIEnv* env)
: java::JavaClass(env, "emu/zenith/data/BiosInfo") {}
: java::JavaClass(env, "emu/cosmic/data/BiosInfo") {}
i32 position;
ZenFile fd;
u32 dataCRC;

View File

@ -1,7 +1,7 @@
#include <hle/bios_patch.h>
#include <eeiv/ee_assembler.h>
namespace zenith::hle {
namespace cosmic::hle {
void BiosPatcher::emit(u32 address) {
mips->writeArray(address, intCodeASM);
}

View File

@ -7,7 +7,7 @@
#include <hle/group_mgr.h>
#include <eeiv/ee_engine.h>
namespace zenith::hle {
namespace cosmic::hle {
class BiosPatcher {
public:
BiosPatcher(JNIEnv* env, std::shared_ptr<eeiv::EEMipsCore>& core)

View File

@ -4,7 +4,7 @@
#include <common/global.h>
#include <hle/group_mgr.h>
namespace zenith::hle {
namespace cosmic::hle {
HLEBiosGroup::HLEBiosGroup(JNIEnv* env) : android(env) {}
void HLEBiosGroup::readBios(std::span<u8> loadHere) {
if (slotBios)

View File

@ -5,7 +5,7 @@
#include <hle/bios_class.h>
#include <fs/bios_loader.h>
namespace zenith::hle {
namespace cosmic::hle {
class HLEBiosGroup {
public:
HLEBiosGroup(JNIEnv* env);

View File

@ -1,9 +1,9 @@
#include <hle/syscall_gate.h>
#include <console/emu_vm.h>
namespace zenith::hle {
namespace cosmic::hle {
void SyscallDealer::hleResetEE(raw_reference<console::EmuVM> vm) {
i32 resetParam{*vm->mips->gprAt<i32*>(Param0)};
i32 resetParam{*vm->mips->gprAt<i32>(Param0)};
if (resetParam == 0) {}
else if (resetParam == 1) {}
}

View File

@ -3,7 +3,7 @@
#include <common/types.h>
#include <console/backdoor.h>
#include <eeiv/ee_info.h>
namespace zenith::hle {
namespace cosmic::hle {
enum CallParams {
Return = eeiv::$v0,
Param0 = eeiv::$a0,

View File

@ -1,7 +1,7 @@
#include <iop/iop_cop.h>
#include <bitset>
namespace zenith::iop {
namespace cosmic::iop {
void IopCop::rfe() {
/*
status.kuc = status.kup;

View File

@ -2,7 +2,7 @@
#include <common/types.h>
#define CastU32(val) static_cast<u32>(val)
namespace zenith::iop {
namespace cosmic::iop {
// https://psx-spx.consoledev.net/cpuspecifications/
struct alignas(8) IopCopStatus {
// iec: Current Interrupt Enable

View File

@ -2,7 +2,7 @@
#include <iop/iop_core.h>
#include <fuji/iop_interpreter.h>
namespace zenith::iop {
namespace cosmic::iop {
void IOMipsCore::intByINTC(bool isInt) {
if (isInt)
cop.cause.intPending |= 0x4;

View File

@ -4,7 +4,7 @@
#include <iop/iop_fuji.h>
#include <iop/iop_cop.h>
namespace zenith::iop {
namespace cosmic::iop {
struct IOPCache {
u32 data;
u32 tag;

View File

@ -1,7 +1,7 @@
#pragma once
#include <common/types.h>
namespace zenith::iop {
namespace cosmic::iop {
class IOMipsCore;
class IOPExecVE {

View File

@ -1,7 +1,7 @@
// SPDX-short-identifier: MIT, Version N/A
// This file is protected by the MIT license (please refer to LICENSE.md before making any changes, copying, or redistributing this software)
#include <iop/iop_intc.h>
namespace zenith::iop {
namespace cosmic::iop {
void IopINTC::iopCheck() {
iop->intByINTC(ctrl && (stat & mask));
}

View File

@ -2,7 +2,7 @@
#include <common/types.h>
#include <iop/iop_core.h>
namespace zenith::iop {
namespace cosmic::iop {
class IopINTC {
public:
IopINTC(std::shared_ptr<IOMipsCore>& mips)

View File

@ -1,6 +1,6 @@
#include <java/device_handler.h>
namespace zenith::java {
namespace cosmic::java {
JvmManager::JvmManager(JavaVM *jvm)
: androidRuntime(jvm) {
void* env{};

View File

@ -2,8 +2,8 @@
#include <memory>
#include <zenith/os/system_state.h>
namespace zenith::java {
#include <os/system_state.h>
namespace cosmic::java {
class JvmManager {
public:
JvmManager(JavaVM* jvm);

Some files were not shown because too many files have changed in this diff Show More