diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/arm/disassembler/arm_disasm.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/ptm_sysm.cpp | 14 | ||||
-rw-r--r-- | src/core/hw/gpu.h | 2 | ||||
-rw-r--r-- | src/video_core/color.h | 19 | ||||
-rw-r--r-- | src/video_core/pica.h | 1 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 23 |
6 files changed, 59 insertions, 8 deletions
diff --git a/src/core/arm/disassembler/arm_disasm.cpp b/src/core/arm/disassembler/arm_disasm.cpp index f7c7451e9..913dc1454 100644 --- a/src/core/arm/disassembler/arm_disasm.cpp +++ b/src/core/arm/disassembler/arm_disasm.cpp @@ -24,7 +24,7 @@ static const char *cond_names[] = { "RESERVED" }; -const char *opcode_names[] = { +static const char *opcode_names[] = { "invalid", "undefined", "adc", @@ -131,7 +131,7 @@ static const char *shift_names[] = { "ROR" }; -static const char* cond_to_str(int cond) { +static const char* cond_to_str(uint32_t cond) { return cond_names[cond]; } @@ -337,8 +337,9 @@ std::string ARM_Disasm::DisassembleBX(uint32_t insn) std::string ARM_Disasm::DisassembleBKPT(uint32_t insn) { + uint8_t cond = (insn >> 28) & 0xf; uint32_t immed = (((insn >> 8) & 0xfff) << 4) | (insn & 0xf); - return Common::StringFromFormat("bkpt\t#%d", immed); + return Common::StringFromFormat("bkpt%s\t#%d", cond_to_str(cond), immed); } std::string ARM_Disasm::DisassembleCLZ(uint32_t insn) @@ -351,7 +352,6 @@ std::string ARM_Disasm::DisassembleCLZ(uint32_t insn) std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn) { - std::string tmp_reg; std::string tmp_list; uint8_t cond = (insn >> 28) & 0xf; diff --git a/src/core/hle/service/ptm_sysm.cpp b/src/core/hle/service/ptm_sysm.cpp index 96ef2dce0..dc4a9c569 100644 --- a/src/core/hle/service/ptm_sysm.cpp +++ b/src/core/hle/service/ptm_sysm.cpp @@ -12,6 +12,18 @@ namespace PTM_SYSM { +/** + * Returns whether the system is powering off (?) + * Outputs: + * 1: Result code, 0 on success, otherwise error code + * 2: Whether the system is going through a power off + */ +void IsLegacyPowerOff(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + cmd_buff[1] = RESULT_SUCCESS.raw; + cmd_buff[2] = 0; +} + const Interface::FunctionInfo FunctionTable[] = { {0x040100C0, nullptr, "SetRtcAlarmEx"}, {0x04020042, nullptr, "ReplySleepQuery"}, @@ -37,7 +49,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x080C0080, nullptr, "SetUserTime"}, {0x080D0000, nullptr, "InvalidateSystemTime"}, {0x080E0140, nullptr, "NotifyPlayEvent"}, - {0x080F0000, nullptr, "IsLegacyPowerOff"}, + {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"}, {0x08100000, nullptr, "ClearLegacyPowerOff"}, {0x08110000, nullptr, "GetShellStatus"}, {0x08120000, nullptr, "IsShutdownByBatteryEmpty"}, diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index ab1dcf91d..737b1e968 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -46,7 +46,7 @@ struct Regs { "Structure size and register block length don't match") #endif - // All of those formats are described in reverse byte order, since the 3DS is little-endian. + // Components are laid out in reverse byte order, most significant bits first. enum class PixelFormat : u32 { RGBA8 = 0, RGB8 = 1, diff --git a/src/video_core/color.h b/src/video_core/color.h index e86ac1265..f095d8ac5 100644 --- a/src/video_core/color.h +++ b/src/video_core/color.h @@ -28,5 +28,24 @@ static inline u8 Convert6To8(u8 value) { return (value << 2) | (value >> 4); } +/// Convert a 8-bit color component to 1 bit +static inline u8 Convert8To1(u8 value) { + return value >> 7; +} + +/// Convert a 8-bit color component to 4 bit +static inline u8 Convert8To4(u8 value) { + return value >> 4; +} + +/// Convert a 8-bit color component to 5 bit +static inline u8 Convert8To5(u8 value) { + return value >> 3; +} + +/// Convert a 8-bit color component to 6 bit +static inline u8 Convert8To6(u8 value) { + return value >> 2; +} } // namespace diff --git a/src/video_core/pica.h b/src/video_core/pica.h index d03b811d3..96d0c72fe 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -409,6 +409,7 @@ struct Regs { } output_merger; struct { + // Components are laid out in reverse byte order, most significant bits first. enum ColorFormat : u32 { RGBA8 = 0, RGB8 = 1, diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index a7bb0612f..8c370781a 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -51,6 +51,16 @@ static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { break; } + case registers.framebuffer.RGBA5551: + { + u16_le* pixel = (u16_le*)(color_buffer + dst_offset); + *pixel = (Color::Convert8To5(color.r()) << 11) | + (Color::Convert8To5(color.g()) << 6) | + (Color::Convert8To5(color.b()) << 1) | + Color::Convert8To1(color.a()); + break; + } + default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); UNIMPLEMENTED(); @@ -66,11 +76,11 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { const u32 coarse_y = y & ~7; u32 bytes_per_pixel = GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(registers.framebuffer.color_format.Value())); u32 src_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * registers.framebuffer.width * bytes_per_pixel; + Math::Vec4<u8> ret; switch (registers.framebuffer.color_format) { case registers.framebuffer.RGBA8: { - Math::Vec4<u8> ret; u8* pixel = color_buffer + src_offset; ret.r() = pixel[3]; ret.g() = pixel[2]; @@ -81,7 +91,6 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { case registers.framebuffer.RGBA4: { - Math::Vec4<u8> ret; u8* pixel = color_buffer + src_offset; ret.r() = Color::Convert4To8(pixel[1] >> 4); ret.g() = Color::Convert4To8(pixel[1] & 0x0F); @@ -90,6 +99,16 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { return ret; } + case registers.framebuffer.RGBA5551: + { + u16_le pixel = *(u16_le*)(color_buffer + src_offset); + ret.r() = Color::Convert5To8((pixel >> 11) & 0x1F); + ret.g() = Color::Convert5To8((pixel >> 6) & 0x1F); + ret.b() = Color::Convert5To8((pixel >> 1) & 0x1F); + ret.a() = Color::Convert1To8(pixel & 0x1); + return ret; + } + default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); UNIMPLEMENTED(); |