Drop unused Android code paths

This commit is contained in:
Tony Wasserka 2024-09-29 18:42:54 +02:00
parent 31e8c433f2
commit df1c1a9103
8 changed files with 4 additions and 116 deletions

View file

@ -1,13 +1,12 @@
#include "jit.hpp" #include "jit.hpp"
#ifndef __ANDROID__
#include <pistache/router.h>
#endif
#include <range/v3/view/enumerate.hpp>
#include <fmt/format.h> #include <fmt/format.h>
#include <pistache/router.h>
#include <range/v3/view/enumerate.hpp>
using namespace Pistache; using namespace Pistache;
// TODO: Move to common header... // TODO: Move to common header...
@ -32,7 +31,6 @@ void JitService::UnregisterContext(HLE::OS::ProcessId pid, HLE::OS::ThreadId tid
contexts.erase(JitId { pid, tid }); contexts.erase(JitId { pid, tid });
} }
#ifndef __ANDROID__
void JitService::doOptions(const Rest::Request&, Http::ResponseWriter response) { void JitService::doOptions(const Rest::Request&, Http::ResponseWriter response) {
response.headers().add<Http::Header::AccessControlAllowOrigin>("*"); response.headers().add<Http::Header::AccessControlAllowOrigin>("*");
response.headers().add<Http::Header::AccessControlAllowHeaders>("user-agent"); response.headers().add<Http::Header::AccessControlAllowHeaders>("user-agent");
@ -85,10 +83,8 @@ void JitService::doJitBlocks(const Rest::Request& request, Http::ResponseWriter
response.send(Http::Code::Ok, body + "]"); response.send(Http::Code::Ok, body + "]");
} }
#endif
void JitService::RegisterRoutes(Rest::Router& router) { void JitService::RegisterRoutes(Rest::Router& router) {
#ifndef __ANDROID__
using namespace Rest; using namespace Rest;
Routes::Get(router, "/jit/:id/blocks", Routes::bind(&JitService::doJitBlocks, this)); Routes::Get(router, "/jit/:id/blocks", Routes::bind(&JitService::doJitBlocks, this));
@ -97,7 +93,6 @@ void JitService::RegisterRoutes(Rest::Router& router) {
Routes::Options(router, "/jit/*/*", Routes::bind(&JitService::doOptions, this)); Routes::Options(router, "/jit/*/*", Routes::bind(&JitService::doOptions, this));
Routes::Options(router, "/jit/*", Routes::bind(&JitService::doOptions, this)); Routes::Options(router, "/jit/*", Routes::bind(&JitService::doOptions, this));
Routes::Options(router, "/jit", Routes::bind(&JitService::doOptions, this)); Routes::Options(router, "/jit", Routes::bind(&JitService::doOptions, this));
#endif
} }
template<> template<>

View file

@ -1,9 +1,7 @@
#include "os.hpp" #include "os.hpp"
#include <os.hpp> #include <os.hpp>
#ifndef __ANDROID__
#include <pistache/router.h> #include <pistache/router.h>
#endif
#include <range/v3/algorithm/copy.hpp> #include <range/v3/algorithm/copy.hpp>
#include <range/v3/iterator/insert_iterators.hpp> #include <range/v3/iterator/insert_iterators.hpp>
@ -40,7 +38,6 @@ void OSService::Shutdown() {
processes.clear(); processes.clear();
} }
#ifndef __ANDROID__
using namespace Pistache; using namespace Pistache;
static void doOptions(const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) { static void doOptions(const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
@ -137,10 +134,8 @@ static void doProcessThreadList(OSService& service, const Pistache::Rest::Reques
} }
response.send(Http::Code::Ok, body + "]"); response.send(Http::Code::Ok, body + "]");
} }
#endif
void OSService::RegisterRoutes(Pistache::Rest::Router& router) { void OSService::RegisterRoutes(Pistache::Rest::Router& router) {
#ifndef __ANDROID__
using namespace Rest; using namespace Rest;
Routes::Get(router, "/os/processes", Routes::Get(router, "/os/processes",
@ -158,7 +153,6 @@ void OSService::RegisterRoutes(Pistache::Rest::Router& router) {
// Routes::Options(router, "/os", Routes::bind(doOptions)); // Routes::Options(router, "/os", Routes::bind(doOptions));
Routes::Options(router, "/os/*", Routes::bind(doOptions)); Routes::Options(router, "/os/*", Routes::bind(doOptions));
Routes::Options(router, "/os/*/*/*", Routes::bind(doOptions)); Routes::Options(router, "/os/*/*/*", Routes::bind(doOptions));
#endif
} }
template<> template<>

View file

@ -58,59 +58,6 @@ void TeakraAudioCallback(std::array<int16_t, 2> samples) {
// g_samples.push_back(std::pair{samples[0], samples[1]}); // g_samples.push_back(std::pair{samples[0], samples[1]});
} }
#ifdef __ANDROID__ // TODO: Consider enabling this elsewhere, too!
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXTptr;
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXTptr;
extern "C" {
VkResult vkCreateDebugReportCallbackEXT(VkInstance_T* a, VkDebugReportCallbackCreateInfoEXT const* b, VkAllocationCallbacks const* c, VkDebugReportCallbackEXT_T** d) {
return vkCreateDebugReportCallbackEXTptr(a, b, c, d);
}
void vkDestroyDebugReportCallbackEXT(VkInstance_T* a, VkDebugReportCallbackEXT_T* b, VkAllocationCallbacks const* c) {
vkDestroyDebugReportCallbackEXTptr(a, b, c);
}
}
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(
VkDebugReportFlagsEXT msgFlags,
VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location,
int32_t msgCode, const char * pLayerPrefix,
const char * pMsg, void * pUserData )
{
if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
__android_log_print(ANDROID_LOG_ERROR,
"MikageValidation",
"ERROR: [%s] Code %i : %s",
pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
__android_log_print(ANDROID_LOG_WARN,
"MikageValidation",
"WARNING: [%s] Code %i : %s",
pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
__android_log_print(ANDROID_LOG_WARN,
"MikageValidation",
"PERFORMANCE WARNING: [%s] Code %i : %s",
pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
__android_log_print(ANDROID_LOG_INFO,
"MikageValidation", "INFO: [%s] Code %i : %s",
pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
__android_log_print(ANDROID_LOG_VERBOSE,
"MikageValidation", "DEBUG: [%s] Code %i : %s",
pLayerPrefix, msgCode, pMsg);
}
// Returning false tells the layer not to stop when the event occurs, so
// they see the same behavior with and without validation layers enabled.
return VK_FALSE;
}
#endif
static volatile int wait_debugger = 0; static volatile int wait_debugger = 0;
namespace Settings { namespace Settings {
@ -557,20 +504,7 @@ if (bootstrap_nand) // Experimental system bootstrapper
auto display = std::make_unique<SDLVulkanDisplay>(frontend_logger, *window, layouts); auto display = std::make_unique<SDLVulkanDisplay>(frontend_logger, *window, layouts);
#ifdef __ANDROID__
//#if 0 // TODO: Re-enable!
{
auto instance = *display->instance;
vkCreateDebugReportCallbackEXTptr = (PFN_vkCreateDebugReportCallbackEXT)
vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
vkDestroyDebugReportCallbackEXTptr = (PFN_vkDestroyDebugReportCallbackEXT)
vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT");
}
vk::DebugReportCallbackCreateInfoEXT callback_info { ~vk::DebugReportFlagsEXT{}, DebugReportCallback };
auto cb = display->instance->createDebugReportCallbackEXTUnique(callback_info);
#endif
std::thread emuthread; std::thread emuthread;
std::exception_ptr emuthread_exception = nullptr; std::exception_ptr emuthread_exception = nullptr;

View file

@ -113,12 +113,6 @@ public: // ... TODO
} }
void ProcessDataSource(::EmuDisplay::Frame& frame, ::EmuDisplay::DataStreamId stream_id) { void ProcessDataSource(::EmuDisplay::Frame& frame, ::EmuDisplay::DataStreamId stream_id) {
#ifdef __ANDROID__
// Right-eye frames are always ignored on Android
if (input->stream_id == ::Display::DataStreamId::TopScreenRightEye) {
return;
}
#endif
// { // {
// auto& active_image = active_images[static_cast<size_t>(input->stream_id)]; // auto& active_image = active_images[static_cast<size_t>(input->stream_id)];
// if (active_image && active_image != input) { // if (active_image && active_image != input) {
@ -287,11 +281,7 @@ public:
SDL_GetWindowSize(&window, &window_width, &window_height); SDL_GetWindowSize(&window, &window_width, &window_height);
logger->info("Swap chain size: {}x{}", window_width, window_height); logger->info("Swap chain size: {}x{}", window_width, window_height);
vk::Extent2D swapchain_size = { static_cast<uint32_t>(window_width), static_cast<uint32_t>(window_height) }; vk::Extent2D swapchain_size = { static_cast<uint32_t>(window_width), static_cast<uint32_t>(window_height) };
#ifdef __ANDROID__
vk::Format swapchain_format = vk::Format::eR8G8B8A8Unorm;
#else
vk::Format swapchain_format = vk::Format::eB8G8R8A8Unorm; // TODO: Don't hardcode. Check against surface_formats instead vk::Format swapchain_format = vk::Format::eB8G8R8A8Unorm; // TODO: Don't hardcode. Check against surface_formats instead
#endif
swapchain = std::invoke([&]() { swapchain = std::invoke([&]() {
vk::SwapchainCreateInfoKHR info { vk::SwapchainCreateFlagBitsKHR { }, vk::SwapchainCreateInfoKHR info { vk::SwapchainCreateFlagBitsKHR { },
@ -457,12 +447,6 @@ public:
// logger->info(message); // logger->info(message);
// std::cerr << message << std::endl; // std::cerr << message << std::endl;
//#ifdef __ANDROID__
// __android_log_print(ANDROID_LOG_ERROR,
// "MikageValidation",
// "%s", message.c_str());
//#endif
// start = std::chrono::high_resolution_clock::now(); // start = std::chrono::high_resolution_clock::now();
// } // }

View file

@ -1,6 +1,4 @@
#ifndef __ANDROID__
#include <cryptopp/sha.h> #include <cryptopp/sha.h>
#endif
#include "display.hpp" #include "display.hpp"
#include "input.hpp" #include "input.hpp"
#include "memory.h" #include "memory.h"
@ -239,7 +237,6 @@ struct GPU : MemoryAccessHandler {
} }
}; };
#ifndef __ANDROID__
// Child of CryptoPP::SHA256, the sole purpose of which is to publish some protected methods of SHA256 // Child of CryptoPP::SHA256, the sole purpose of which is to publish some protected methods of SHA256
struct MySHA256 : CryptoPP::SHA256 { struct MySHA256 : CryptoPP::SHA256 {
using Parent = IteratedHashWithStaticTransform<CryptoPP::word32, CryptoPP::BigEndian, 64, 32, CryptoPP::SHA256, 32, true>; using Parent = IteratedHashWithStaticTransform<CryptoPP::word32, CryptoPP::BigEndian, 64, 32, CryptoPP::SHA256, 32, true>;
@ -284,7 +281,6 @@ struct CryptoPPPrivateDataMembersWorkaround {
template struct CryptoPPPrivateDataMembersWorkaround<ByteCountHiMember, &MySHA256::IteratedHashBase::m_countHi>; template struct CryptoPPPrivateDataMembersWorkaround<ByteCountHiMember, &MySHA256::IteratedHashBase::m_countHi>;
template struct CryptoPPPrivateDataMembersWorkaround<ByteCountLoMember, &MySHA256::IteratedHashBase::m_countLo>; template struct CryptoPPPrivateDataMembersWorkaround<ByteCountLoMember, &MySHA256::IteratedHashBase::m_countLo>;
#endif
struct HASH : MemoryAccessHandler { struct HASH : MemoryAccessHandler {
std::shared_ptr<spdlog::logger> logger; std::shared_ptr<spdlog::logger> logger;
@ -296,7 +292,6 @@ struct HASH : MemoryAccessHandler {
} }
#ifndef __ANDROID__
uint32_t Read32(uint32_t offset) { uint32_t Read32(uint32_t offset) {
// static int iter = 0; // static int iter = 0;
@ -447,7 +442,6 @@ struct HASH : MemoryAccessHandler {
} }
logger->warn("{}-bit write to HASH register {:#010x} {:#x}<- {:#010x}", sizeof(T) * 8, base, offset, value); logger->warn("{}-bit write to HASH register {:#010x} {:#x}<- {:#010x}", sizeof(T) * 8, base, offset, value);
} }
#endif // ANDROID
}; };
struct GPIO : MemoryAccessHandler { struct GPIO : MemoryAccessHandler {

View file

@ -5715,14 +5715,12 @@ static uint64_t timestamp = 0; // TODO
} }
// If 3D is enabled, push a frame for the right-eye image, too // If 3D is enabled, push a frame for the right-eye image, too
#ifndef __ANDROID__ // Android ignores the right-eye frame
if (fb_format & (1 << 5)) { if (fb_format & (1 << 5)) {
auto data_addr = Memory::ReadLegacy<uint32_t>(mem, gpu_base + 0x494 + fb_select * 4); auto data_addr = Memory::ReadLegacy<uint32_t>(mem, gpu_base + 0x494 + fb_select * 4);
auto& frame = display.PrepareImage(EmuDisplay::DataStreamId::TopScreenRightEye, ++timestamp); auto& frame = display.PrepareImage(EmuDisplay::DataStreamId::TopScreenRightEye, ++timestamp);
renderer.ProduceFrame(display, frame, mem, EmuDisplay::DataStreamId::TopScreenRightEye, data_addr, fb_stride, format); renderer.ProduceFrame(display, frame, mem, EmuDisplay::DataStreamId::TopScreenRightEye, data_addr, fb_stride, format);
display.PushImage(EmuDisplay::DataStreamId::TopScreenRightEye, frame, timestamp); display.PushImage(EmuDisplay::DataStreamId::TopScreenRightEye, frame, timestamp);
} }
#endif
} }
if (Memory::ReadLegacy<uint32_t>(mem, gpu_base + 0x574) & 1) { if (Memory::ReadLegacy<uint32_t>(mem, gpu_base + 0x574) & 1) {

View file

@ -84,7 +84,6 @@ EmuSession::EmuSession( LogManager& log_manager, Settings::Settings& settings,
setup->mem.InjectDependency(input); setup->mem.InjectDependency(input);
// TODO: Check if we can enable this on Android, too // TODO: Check if we can enable this on Android, too
#ifndef __ANDROID__
network_console = std::make_unique<NetworkConsole>(12347); network_console = std::make_unique<NetworkConsole>(12347);
console_thread = std::thread { [os_module=std::move(os_module), &console=*network_console]() mutable { console_thread = std::thread { [os_module=std::move(os_module), &console=*network_console]() mutable {
console.RegisterModule("os", std::move(os_module)); console.RegisterModule("os", std::move(os_module));
@ -102,7 +101,6 @@ EmuSession::EmuSession( LogManager& log_manager, Settings::Settings& settings,
} }
}); });
debug_server_thread.detach(); debug_server_thread.detach();
#endif
#endif #endif
} }

View file

@ -96,11 +96,7 @@ namespace Pica {
namespace Vulkan { namespace Vulkan {
// TODO: Detect at runtime // TODO: Detect at runtime
#ifndef __ANDROID__
const bool requires_32bit_depth = true; /* True if device does not support 24-bit depth and instead needs 32-bit */ const bool requires_32bit_depth = true; /* True if device does not support 24-bit depth and instead needs 32-bit */
#else
const bool requires_32bit_depth = false;
#endif
const vk::Format internal_depth_format = requires_32bit_depth ? vk::Format::eD32SfloatS8Uint : vk::Format::eD24UnormS8Uint; const vk::Format internal_depth_format = requires_32bit_depth ? vk::Format::eD32SfloatS8Uint : vk::Format::eD24UnormS8Uint;
void ResourceReadHandler::OnRead(PAddr read_addr, uint32_t read_size) { void ResourceReadHandler::OnRead(PAddr read_addr, uint32_t read_size) {
@ -902,12 +898,7 @@ void ResourceManager::RefreshStagedMemory(
case GenericImageFormat::RGBA8: case GenericImageFormat::RGBA8:
{ {
auto value = Memory::Read<uint32_t>(source_memory, x * nibbles_per_pixel / 2 + y * stride); auto value = Memory::Read<uint32_t>(source_memory, x * nibbles_per_pixel / 2 + y * stride);
#ifdef __ANDROID__
// TODO: Uhm.. gotta figure out which order to put the components in here
value = ((value & 0xff) << 24) | ((value & 0xff00) << 8) | ((value & 0xff0000) >> 8) | (value >> 24); value = ((value & 0xff) << 24) | ((value & 0xff00) << 8) | ((value & 0xff0000) >> 8) | (value >> 24);
#else
value = ((value & 0xff) << 24) | ((value & 0xff00) << 8) | ((value & 0xff0000) >> 8) | (value >> 24);
#endif
memcpy(fb_data_ptr, &value, sizeof(value)); memcpy(fb_data_ptr, &value, sizeof(value));
fb_data_ptr += sizeof(value); fb_data_ptr += sizeof(value);
break; break;