diff --git a/source/debug/jit.cpp b/source/debug/jit.cpp index 2d2f93e..e0ad336 100644 --- a/source/debug/jit.cpp +++ b/source/debug/jit.cpp @@ -1,13 +1,12 @@ #include "jit.hpp" -#ifndef __ANDROID__ -#include -#endif - -#include #include +#include + +#include + using namespace Pistache; // 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 }); } -#ifndef __ANDROID__ void JitService::doOptions(const Rest::Request&, Http::ResponseWriter response) { response.headers().add("*"); response.headers().add("user-agent"); @@ -85,10 +83,8 @@ void JitService::doJitBlocks(const Rest::Request& request, Http::ResponseWriter response.send(Http::Code::Ok, body + "]"); } -#endif void JitService::RegisterRoutes(Rest::Router& router) { -#ifndef __ANDROID__ using namespace Rest; 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)); -#endif } template<> diff --git a/source/debug/os.cpp b/source/debug/os.cpp index c087e31..349f176 100644 --- a/source/debug/os.cpp +++ b/source/debug/os.cpp @@ -1,9 +1,7 @@ #include "os.hpp" #include -#ifndef __ANDROID__ #include -#endif #include #include @@ -40,7 +38,6 @@ void OSService::Shutdown() { processes.clear(); } -#ifndef __ANDROID__ using namespace Pistache; 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 + "]"); } -#endif void OSService::RegisterRoutes(Pistache::Rest::Router& router) { -#ifndef __ANDROID__ using namespace Rest; 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)); -#endif } template<> diff --git a/source/gui-sdl/main.cpp b/source/gui-sdl/main.cpp index a81f3b2..65093ba 100644 --- a/source/gui-sdl/main.cpp +++ b/source/gui-sdl/main.cpp @@ -58,59 +58,6 @@ void TeakraAudioCallback(std::array samples) { // 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; namespace Settings { @@ -557,20 +504,7 @@ if (bootstrap_nand) // Experimental system bootstrapper auto display = std::make_unique(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::exception_ptr emuthread_exception = nullptr; diff --git a/source/gui-sdl/sdl_vulkan_display.hpp b/source/gui-sdl/sdl_vulkan_display.hpp index 4c75217..677bde1 100644 --- a/source/gui-sdl/sdl_vulkan_display.hpp +++ b/source/gui-sdl/sdl_vulkan_display.hpp @@ -113,12 +113,6 @@ public: // ... TODO } 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(input->stream_id)]; // if (active_image && active_image != input) { @@ -287,11 +281,7 @@ public: SDL_GetWindowSize(&window, &window_width, &window_height); logger->info("Swap chain size: {}x{}", window_width, window_height); vk::Extent2D swapchain_size = { static_cast(window_width), static_cast(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 -#endif swapchain = std::invoke([&]() { vk::SwapchainCreateInfoKHR info { vk::SwapchainCreateFlagBitsKHR { }, @@ -457,12 +447,6 @@ public: // logger->info(message); // 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(); // } diff --git a/source/memory.cpp b/source/memory.cpp index c454791..722858e 100644 --- a/source/memory.cpp +++ b/source/memory.cpp @@ -1,6 +1,4 @@ -#ifndef __ANDROID__ #include -#endif #include "display.hpp" #include "input.hpp" #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 struct MySHA256 : CryptoPP::SHA256 { using Parent = IteratedHashWithStaticTransform; @@ -284,7 +281,6 @@ struct CryptoPPPrivateDataMembersWorkaround { template struct CryptoPPPrivateDataMembersWorkaround; template struct CryptoPPPrivateDataMembersWorkaround; -#endif struct HASH : MemoryAccessHandler { std::shared_ptr logger; @@ -296,7 +292,6 @@ struct HASH : MemoryAccessHandler { } -#ifndef __ANDROID__ uint32_t Read32(uint32_t offset) { // 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); } -#endif // ANDROID }; struct GPIO : MemoryAccessHandler { diff --git a/source/os.cpp b/source/os.cpp index 19a670d..ba9b313 100644 --- a/source/os.cpp +++ b/source/os.cpp @@ -5715,14 +5715,12 @@ static uint64_t timestamp = 0; // TODO } // 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)) { auto data_addr = Memory::ReadLegacy(mem, gpu_base + 0x494 + fb_select * 4); auto& frame = display.PrepareImage(EmuDisplay::DataStreamId::TopScreenRightEye, ++timestamp); renderer.ProduceFrame(display, frame, mem, EmuDisplay::DataStreamId::TopScreenRightEye, data_addr, fb_stride, format); display.PushImage(EmuDisplay::DataStreamId::TopScreenRightEye, frame, timestamp); } -#endif } if (Memory::ReadLegacy(mem, gpu_base + 0x574) & 1) { diff --git a/source/session.cpp b/source/session.cpp index 1e647ca..a5af94d 100644 --- a/source/session.cpp +++ b/source/session.cpp @@ -84,7 +84,6 @@ EmuSession::EmuSession( LogManager& log_manager, Settings::Settings& settings, setup->mem.InjectDependency(input); // TODO: Check if we can enable this on Android, too -#ifndef __ANDROID__ network_console = std::make_unique(12347); console_thread = std::thread { [os_module=std::move(os_module), &console=*network_console]() mutable { console.RegisterModule("os", std::move(os_module)); @@ -102,7 +101,6 @@ EmuSession::EmuSession( LogManager& log_manager, Settings::Settings& settings, } }); debug_server_thread.detach(); -#endif #endif } diff --git a/source/video_core/src/video_core/vulkan/resource_manager.cpp b/source/video_core/src/video_core/vulkan/resource_manager.cpp index ea8f4ee..e4c5934 100644 --- a/source/video_core/src/video_core/vulkan/resource_manager.cpp +++ b/source/video_core/src/video_core/vulkan/resource_manager.cpp @@ -96,11 +96,7 @@ namespace Pica { namespace Vulkan { // 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 */ -#else -const bool requires_32bit_depth = false; -#endif 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) { @@ -902,12 +898,7 @@ void ResourceManager::RefreshStagedMemory( case GenericImageFormat::RGBA8: { auto value = Memory::Read(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); -#else - value = ((value & 0xff) << 24) | ((value & 0xff00) << 8) | ((value & 0xff0000) >> 8) | (value >> 24); -#endif memcpy(fb_data_ptr, &value, sizeof(value)); fb_data_ptr += sizeof(value); break;