diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/arm/arm_interface.h | 6 | ||||
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom.cpp | 5 | ||||
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/svc.cpp | 5 | ||||
-rw-r--r-- | src/core/hw/gpu.cpp | 19 | ||||
-rw-r--r-- | src/core/hw/gpu.h | 2 | ||||
-rw-r--r-- | src/core/loader/ncch.h | 25 |
8 files changed, 35 insertions, 34 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index ef37ee055..fe1e584ad 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -74,12 +74,6 @@ public: virtual void SetCPSR(u32 cpsr) = 0; /** - * Returns the number of clock ticks since the last rese - * @return Returns number of clock ticks - */ - virtual u64 GetTicks() const = 0; - - /** * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time) * @param ticks Number of ticks to advance the CPU core */ diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index bbcbbdd2b..cb1a410a0 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -68,11 +68,6 @@ void ARM_DynCom::SetCPSR(u32 cpsr) { state->Cpsr = cpsr; } -u64 ARM_DynCom::GetTicks() const { - // TODO(Subv): Remove ARM_DynCom::GetTicks() and use CoreTiming::GetTicks() directly once ARMemu is gone - return CoreTiming::GetTicks(); -} - void ARM_DynCom::AddTicks(u64 ticks) { down_count -= ticks; if (down_count < 0) diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h index 213cac1ad..a7f95d307 100644 --- a/src/core/arm/dyncom/arm_dyncom.h +++ b/src/core/arm/dyncom/arm_dyncom.h @@ -23,7 +23,6 @@ public: u32 GetCPSR() const override; void SetCPSR(u32 cpsr) override; - u64 GetTicks() const override; void AddTicks(u64 ticks) override; void ResetContext(Core::ThreadContext& context, u32 stack_top, u32 entry_point, u32 arg); diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 6a763fd51..138603d9b 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -7,7 +7,7 @@ #include "core/hle/service/hid/hid_spvr.h" #include "core/hle/service/hid/hid_user.h" -#include "core/arm/arm_interface.h" +#include "core/core_timing.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/hle.h" @@ -82,7 +82,7 @@ void HIDUpdate() { // If we just updated index 0, provide a new timestamp if (mem->pad.index == 0) { mem->pad.index_reset_ticks_previous = mem->pad.index_reset_ticks; - mem->pad.index_reset_ticks = (s64)Core::g_app_core->GetTicks(); + mem->pad.index_reset_ticks = (s64)CoreTiming::GetTicks(); } mem->touch.index = next_touch_index; @@ -102,7 +102,7 @@ void HIDUpdate() { // If we just updated index 0, provide a new timestamp if (mem->touch.index == 0) { mem->touch.index_reset_ticks_previous = mem->touch.index_reset_ticks; - mem->touch.index_reset_ticks = (s64)Core::g_app_core->GetTicks(); + mem->touch.index_reset_ticks = (s64)CoreTiming::GetTicks(); } // Signal both handles when there's an update to Pad or touch diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 17385f9b2..bbb4eb9cd 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -7,8 +7,9 @@ #include "common/string_util.h" #include "common/symbols.h" -#include "core/arm/arm_interface.h" +#include "core/core_timing.h" #include "core/mem_map.h" +#include "core/arm/arm_interface.h" #include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/event.h" @@ -551,7 +552,7 @@ static void SleepThread(s64 nanoseconds) { /// This returns the total CPU ticks elapsed since the CPU was powered-on static s64 GetSystemTick() { - return (s64)Core::g_app_core->GetTicks(); + return (s64)CoreTiming::GetTicks(); } /// Creates a memory block at the specified address with the specified permissions and size diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index f933a5e8d..07443616e 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -146,8 +146,17 @@ inline void Write(u32 addr, const T data) { for (u32 x = 0; x < output_width; ++x) { Math::Vec4<u8> src_color = { 0, 0, 0, 0 }; - u32 scaled_x = x * horizontal_scale; - u32 scaled_y = y * vertical_scale; + // Calculate the [x,y] position of the input image + // based on the current output position and the scale + u32 input_x = x * horizontal_scale; + u32 input_y = y * vertical_scale; + + if (config.flip_vertically) { + // Flip the y value of the output data, + // we do this after calculating the [x,y] position of the input image + // to account for the scaling options. + y = output_height - y - 1; + } u32 dst_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.output_format); u32 src_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.input_format); @@ -159,14 +168,14 @@ inline void Write(u32 addr, const T data) { u32 coarse_y = y & ~7; u32 stride = output_width * dst_bytes_per_pixel; - src_offset = (scaled_x + scaled_y * config.input_width) * src_bytes_per_pixel; + src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel; dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride; } else { // Interpret the input as tiled and the output as linear - u32 coarse_y = scaled_y & ~7; + u32 coarse_y = input_y & ~7; u32 stride = config.input_width * src_bytes_per_pixel; - src_offset = VideoCore::GetMortonOffset(scaled_x, scaled_y, src_bytes_per_pixel) + coarse_y * stride; + src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + coarse_y * stride; dst_offset = (x + y * output_width) * dst_bytes_per_pixel; } diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index 5b7f0a4e9..e8552d854 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -191,7 +191,7 @@ struct Regs { union { u32 flags; - BitField< 0, 1, u32> flip_data; // flips input data horizontally (TODO) if true + BitField< 0, 1, u32> flip_vertically; // flips input data vertically BitField< 1, 1, u32> output_tiled; // Converts from linear to tiled format BitField< 3, 1, u32> raw_copy; // Copies the data without performing any processing BitField< 8, 3, PixelFormat> input_format; diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 9ae2de99f..f6f670060 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -20,8 +20,8 @@ struct NCCH_Header { u16 version; u8 reserved_0[4]; u8 program_id[8]; - u8 temp_flag; - u8 reserved_1[0x2f]; + u8 reserved_1[0x10]; + u8 logo_region_hash[0x20]; u8 product_code[0x10]; u8 extended_header_hash[0x20]; u32 extended_header_size; @@ -29,15 +29,16 @@ struct NCCH_Header { u8 flags[8]; u32 plain_region_offset; u32 plain_region_size; - u8 reserved_3[8]; + u32 logo_region_offset; + u32 logo_region_size; u32 exefs_offset; u32 exefs_size; u32 exefs_hash_region_size; - u8 reserved_4[4]; + u8 reserved_3[4]; u32 romfs_offset; u32 romfs_size; u32 romfs_hash_region_size; - u8 reserved_5[4]; + u8 reserved_4[4]; u8 exefs_super_block_hash[0x20]; u8 romfs_super_block_hash[0x20]; }; @@ -88,8 +89,7 @@ struct ExHeader_DependencyList{ }; struct ExHeader_SystemInfo{ - u32 save_data_size; - u8 reserved[4]; + u64 save_data_size; u8 jump_id[8]; u8 reserved_2[0x30]; }; @@ -104,11 +104,14 @@ struct ExHeader_StorageInfo{ struct ExHeader_ARM11_SystemLocalCaps{ u8 program_id[8]; - u8 flags[8]; - u8 resource_limit_descriptor[0x10][2]; + u32 core_version; + u8 flags[3]; + u8 priority; + u8 resource_limit_descriptor[0x16][2]; ExHeader_StorageInfo storage_info; - u8 service_access_control[0x20][8]; - u8 reserved[0x1f]; + u8 service_access_control[0x32][8]; + u8 ex_service_access_control[0x2][8]; + u8 reserved[0xf]; u8 resource_limit_category; }; |