VERY experimental Nintendo Switch 2 emulator
C++
hw: Remove unused files
Lioncashdb3603df9468
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 3cc9160ca0..c055009522 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -309,10 +309,6 @@ add_library(core STATIChle/service/vi/vi_u.hhle/service/wlan/wlan.cpphle/service/wlan/wlan.h- hw/hw.cpp- hw/hw.h- hw/lcd.cpp- hw/lcd.hloader/deconstructed_rom_directory.cpploader/deconstructed_rom_directory.hloader/elf.cppdiff --git a/src/core/core.cpp b/src/core/core.cppindex b7f4b45323..dd845a78a4 100644--- a/src/core/core.cpp+++ b/src/core/core.cpp@@ -15,7 +15,6 @@#include "core/hle/service/service.h"#include "core/hle/service/sm/controller.h"#include "core/hle/service/sm/sm.h"-#include "core/hw/hw.h"#include "core/loader/loader.h"#include "core/memory_setup.h"#include "core/settings.h"@@ -180,7 +179,6 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {telemetry_session = std::make_unique<Core::TelemetrySession>();service_manager = std::make_shared<Service::SM::ServiceManager>();- HW::Init();Kernel::Init(system_mode);Service::Init(service_manager);GDBStub::Init();@@ -224,7 +222,6 @@ void System::Shutdown() {GDBStub::Shutdown();Service::Shutdown();Kernel::Shutdown();- HW::Shutdown();service_manager.reset();telemetry_session.reset();gpu_core.reset();diff --git a/src/core/hw/aes/ccm.cpp b/src/core/hw/aes/ccm.cppdeleted file mode 100644index 1ee37aaa4d..0000000000--- a/src/core/hw/aes/ccm.cpp+++ /dev/null@@ -1,28 +0,0 @@-// Copyright 2017 Citra Emulator Project-// Licensed under GPLv2 or any later version-// Refer to the license.txt file included.--#include <algorithm>-#include "common/alignment.h"-#include "common/assert.h"-#include "common/logging/log.h"-#include "core/hw/aes/ccm.h"-#include "core/hw/aes/key.h"--namespace HW {-namespace AES {--std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce,- size_t slot_id) {- UNIMPLEMENTED();- return {};-}--std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,- size_t slot_id) {- UNIMPLEMENTED();- return {};-}--} // namespace AES-} // namespace HWdiff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cppdeleted file mode 100644index 2f48068c1e..0000000000--- a/src/core/hw/hw.cpp+++ /dev/null@@ -1,96 +0,0 @@-// Copyright 2014 Citra Emulator Project-// Licensed under GPLv2 or any later version-// Refer to the license.txt file included.--#include "common/common_types.h"-#include "common/logging/log.h"-#include "core/hw/hw.h"-#include "core/hw/lcd.h"--namespace HW {--template <typename T>-inline void Read(T& var, const u32 addr) {- switch (addr & 0xFFFFF000) {- case VADDR_GPU:- case VADDR_GPU + 0x1000:- case VADDR_GPU + 0x2000:- case VADDR_GPU + 0x3000:- case VADDR_GPU + 0x4000:- case VADDR_GPU + 0x5000:- case VADDR_GPU + 0x6000:- case VADDR_GPU + 0x7000:- case VADDR_GPU + 0x8000:- case VADDR_GPU + 0x9000:- case VADDR_GPU + 0xA000:- case VADDR_GPU + 0xB000:- case VADDR_GPU + 0xC000:- case VADDR_GPU + 0xD000:- case VADDR_GPU + 0xE000:- case VADDR_GPU + 0xF000:- break;- case VADDR_LCD:- LCD::Read(var, addr);- break;- default:- LOG_ERROR(HW_Memory, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr);- break;- }-}--template <typename T>-inline void Write(u32 addr, const T data) {- switch (addr & 0xFFFFF000) {- case VADDR_GPU:- case VADDR_GPU + 0x1000:- case VADDR_GPU + 0x2000:- case VADDR_GPU + 0x3000:- case VADDR_GPU + 0x4000:- case VADDR_GPU + 0x5000:- case VADDR_GPU + 0x6000:- case VADDR_GPU + 0x7000:- case VADDR_GPU + 0x8000:- case VADDR_GPU + 0x9000:- case VADDR_GPU + 0xA000:- case VADDR_GPU + 0xB000:- case VADDR_GPU + 0xC000:- case VADDR_GPU + 0xD000:- case VADDR_GPU + 0xE000:- case VADDR_GPU + 0xF000:- break;- case VADDR_LCD:- LCD::Write(addr, data);- break;- default:- LOG_ERROR(HW_Memory, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr);- break;- }-}--// Explicitly instantiate template functions because we aren't defining this in the header:--template void Read<u64>(u64& var, const u32 addr);-template void Read<u32>(u32& var, const u32 addr);-template void Read<u16>(u16& var, const u32 addr);-template void Read<u8>(u8& var, const u32 addr);--template void Write<u64>(u32 addr, const u64 data);-template void Write<u32>(u32 addr, const u32 data);-template void Write<u16>(u32 addr, const u16 data);-template void Write<u8>(u32 addr, const u8 data);--/// Update hardware-void Update() {}--/// Initialize hardware-void Init() {- LCD::Init();- LOG_DEBUG(HW, "Initialized OK");-}--/// Shutdown hardware-void Shutdown() {- LCD::Shutdown();- LOG_DEBUG(HW, "Shutdown OK");-}-} // namespace HWdiff --git a/src/core/hw/hw.h b/src/core/hw/hw.hdeleted file mode 100644index 5890d2b5c0..0000000000--- a/src/core/hw/hw.h+++ /dev/null@@ -1,50 +0,0 @@-// Copyright 2014 Citra Emulator Project-// Licensed under GPLv2 or any later version-// Refer to the license.txt file included.--#pragma once--#include "common/common_types.h"--namespace HW {--/// Beginnings of IO register regions, in the user VA space.-enum : u32 {- VADDR_HASH = 0x1EC01000,- VADDR_CSND = 0x1EC03000,- VADDR_DSP = 0x1EC40000,- VADDR_PDN = 0x1EC41000,- VADDR_CODEC = 0x1EC41000,- VADDR_SPI = 0x1EC42000,- VADDR_SPI_2 = 0x1EC43000, // Only used under TWL_FIRM?- VADDR_I2C = 0x1EC44000,- VADDR_CODEC_2 = 0x1EC45000,- VADDR_HID = 0x1EC46000,- VADDR_GPIO = 0x1EC47000,- VADDR_I2C_2 = 0x1EC48000,- VADDR_SPI_3 = 0x1EC60000,- VADDR_I2C_3 = 0x1EC61000,- VADDR_MIC = 0x1EC62000,- VADDR_PXI = 0x1EC63000,- VADDR_LCD = 0x1ED02000,- VADDR_DSP_2 = 0x1ED03000,- VADDR_HASH_2 = 0x1EE01000,- VADDR_GPU = 0x1EF00000,-};--template <typename T>-void Read(T& var, const u32 addr);--template <typename T>-void Write(u32 addr, const T data);--/// Update hardware-void Update();--/// Initialize hardware-void Init();--/// Shutdown hardware-void Shutdown();--} // namespace HWdiff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cppdeleted file mode 100644index 0b62174d58..0000000000--- a/src/core/hw/lcd.cpp+++ /dev/null@@ -1,67 +0,0 @@-// Copyright 2015 Citra Emulator Project-// Licensed under GPLv2 or any later version-// Refer to the license.txt file included.--#include <cstring>-#include "common/common_types.h"-#include "common/logging/log.h"-#include "core/hw/hw.h"-#include "core/hw/lcd.h"-#include "core/tracer/recorder.h"--namespace LCD {--Regs g_regs;--template <typename T>-inline void Read(T& var, const u32 raw_addr) {- u32 addr = raw_addr - HW::VADDR_LCD;- u32 index = addr / 4;-- // Reads other than u32 are untested, so I'd rather have them abort than silently fail- if (index >= 0x400 || !std::is_same<T, u32>::value) {- LOG_ERROR(HW_LCD, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr);- return;- }-- var = g_regs[index];-}--template <typename T>-inline void Write(u32 addr, const T data) {- addr -= HW::VADDR_LCD;- u32 index = addr / 4;-- // Writes other than u32 are untested, so I'd rather have them abort than silently fail- if (index >= 0x400 || !std::is_same<T, u32>::value) {- LOG_ERROR(HW_LCD, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr);- return;- }-- g_regs[index] = static_cast<u32>(data);-}--// Explicitly instantiate template functions because we aren't defining this in the header:--template void Read<u64>(u64& var, const u32 addr);-template void Read<u32>(u32& var, const u32 addr);-template void Read<u16>(u16& var, const u32 addr);-template void Read<u8>(u8& var, const u32 addr);--template void Write<u64>(u32 addr, const u64 data);-template void Write<u32>(u32 addr, const u32 data);-template void Write<u16>(u32 addr, const u16 data);-template void Write<u8>(u32 addr, const u8 data);--/// Initialize hardware-void Init() {- memset(&g_regs, 0, sizeof(g_regs));- LOG_DEBUG(HW_LCD, "Initialized OK");-}--/// Shutdown hardware-void Shutdown() {- LOG_DEBUG(HW_LCD, "Shutdown OK");-}--} // namespace LCDdiff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.hdeleted file mode 100644index d2db9700f4..0000000000--- a/src/core/hw/lcd.h+++ /dev/null@@ -1,86 +0,0 @@-// Copyright 2015 Citra Emulator Project-// Licensed under GPLv2 or any later version-// Refer to the license.txt file included.--#pragma once--#include <cstddef>-#include <type_traits>-#include "common/bit_field.h"-#include "common/common_funcs.h"-#include "common/common_types.h"--#define LCD_REG_INDEX(field_name) (offsetof(LCD::Regs, field_name) / sizeof(u32))--namespace LCD {--struct Regs {-- union ColorFill {- u32 raw;-- BitField<0, 8, u32> color_r;- BitField<8, 8, u32> color_g;- BitField<16, 8, u32> color_b;- BitField<24, 1, u32> is_enabled;- };-- INSERT_PADDING_WORDS(0x81);- ColorFill color_fill_top;- INSERT_PADDING_WORDS(0xE);- u32 backlight_top;-- INSERT_PADDING_WORDS(0x1F0);-- ColorFill color_fill_bottom;- INSERT_PADDING_WORDS(0xE);- u32 backlight_bottom;- INSERT_PADDING_WORDS(0x16F);-- static constexpr size_t NumIds() {- return sizeof(Regs) / sizeof(u32);- }-- const u32& operator[](int index) const {- const u32* content = reinterpret_cast<const u32*>(this);- return content[index];- }-- u32& operator[](int index) {- u32* content = reinterpret_cast<u32*>(this);- return content[index];- }-};-static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout");--// TODO: MSVC does not support using offsetof() on non-static data members even though this-// is technically allowed since C++11. This macro should be enabled once MSVC adds-// support for that.-#ifndef _MSC_VER-#define ASSERT_REG_POSITION(field_name, position) \- static_assert(offsetof(Regs, field_name) == position * 4, \- "Field " #field_name " has invalid position")--ASSERT_REG_POSITION(color_fill_top, 0x81);-ASSERT_REG_POSITION(backlight_top, 0x90);-ASSERT_REG_POSITION(color_fill_bottom, 0x281);-ASSERT_REG_POSITION(backlight_bottom, 0x290);--#undef ASSERT_REG_POSITION-#endif // !defined(_MSC_VER)--extern Regs g_regs;--template <typename T>-void Read(T& var, const u32 addr);--template <typename T>-void Write(u32 addr, const T data);--/// Initialize hardware-void Init();--/// Shutdown hardware-void Shutdown();--} // namespace LCD