diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 7 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.cpp | 33 | ||||
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 48 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 2 |
5 files changed, 63 insertions, 31 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index e4b5486e0..b5d1b43cd 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -3564,17 +3564,13 @@ static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, u32 addr) { | |||
| 3564 | unsigned int inst, inst_size = 4; | 3564 | unsigned int inst, inst_size = 4; |
| 3565 | int idx; | 3565 | int idx; |
| 3566 | int ret = NON_BRANCH; | 3566 | int ret = NON_BRANCH; |
| 3567 | int thumb = 0; | ||
| 3568 | int size = 0; // instruction size of basic block | 3567 | int size = 0; // instruction size of basic block |
| 3569 | bb_start = top; | 3568 | bb_start = top; |
| 3570 | 3569 | ||
| 3571 | if (cpu->TFlag) | ||
| 3572 | thumb = THUMB; | ||
| 3573 | |||
| 3574 | u32 phys_addr = addr; | 3570 | u32 phys_addr = addr; |
| 3575 | u32 pc_start = cpu->Reg[15]; | 3571 | u32 pc_start = cpu->Reg[15]; |
| 3576 | 3572 | ||
| 3577 | while(ret == NON_BRANCH) { | 3573 | while (ret == NON_BRANCH) { |
| 3578 | inst = Memory::Read32(phys_addr & 0xFFFFFFFC); | 3574 | inst = Memory::Read32(phys_addr & 0xFFFFFFFC); |
| 3579 | 3575 | ||
| 3580 | size++; | 3576 | size++; |
| @@ -3890,7 +3886,6 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { | |||
| 3890 | 3886 | ||
| 3891 | #define CurrentModeHasSPSR (cpu->Mode != SYSTEM32MODE) && (cpu->Mode != USER32MODE) | 3887 | #define CurrentModeHasSPSR (cpu->Mode != SYSTEM32MODE) && (cpu->Mode != USER32MODE) |
| 3892 | #define PC (cpu->Reg[15]) | 3888 | #define PC (cpu->Reg[15]) |
| 3893 | #define CHECK_EXT_INT if (!cpu->NirqSig && !(cpu->Cpsr & 0x80)) goto END; | ||
| 3894 | 3889 | ||
| 3895 | // GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback | 3890 | // GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback |
| 3896 | // to a clunky switch statement. | 3891 | // to a clunky switch statement. |
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp index 08b5c0b77..cdaf21450 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp +++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp | |||
| @@ -189,33 +189,22 @@ tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) { | |||
| 189 | 189 | ||
| 190 | case 10: | 190 | case 10: |
| 191 | case 11: | 191 | case 11: |
| 192 | // TODO: Format 7 and Format 8 perform the same ARM encoding, so the following could be | 192 | { |
| 193 | // merged into a single subset, saving on the following boolean: | 193 | static const ARMword subset[8] = { |
| 194 | 194 | 0xE7800000, // STR Rd,[Rb,Ro] | |
| 195 | if ((tinstr & (1 << 9)) == 0) { | ||
| 196 | static const ARMword subset[4] = { | ||
| 197 | 0xE7800000, // STR Rd,[Rb,Ro] | ||
| 198 | 0xE7C00000, // STRB Rd,[Rb,Ro] | ||
| 199 | 0xE7900000, // LDR Rd,[Rb,Ro] | ||
| 200 | 0xE7D00000 // LDRB Rd,[Rb,Ro] | ||
| 201 | }; | ||
| 202 | |||
| 203 | *ainstr = subset[(tinstr & 0x0C00) >> 10] // base | ||
| 204 | |((tinstr & 0x0007) << (12 - 0)) // Rd | ||
| 205 | |((tinstr & 0x0038) << (16 - 3)) // Rb | ||
| 206 | |((tinstr & 0x01C0) >> 6); // Ro | ||
| 207 | |||
| 208 | } else { | ||
| 209 | static const ARMword subset[4] = { | ||
| 210 | 0xE18000B0, // STRH Rd,[Rb,Ro] | 195 | 0xE18000B0, // STRH Rd,[Rb,Ro] |
| 196 | 0xE7C00000, // STRB Rd,[Rb,Ro] | ||
| 211 | 0xE19000D0, // LDRSB Rd,[Rb,Ro] | 197 | 0xE19000D0, // LDRSB Rd,[Rb,Ro] |
| 198 | 0xE7900000, // LDR Rd,[Rb,Ro] | ||
| 212 | 0xE19000B0, // LDRH Rd,[Rb,Ro] | 199 | 0xE19000B0, // LDRH Rd,[Rb,Ro] |
| 200 | 0xE7D00000, // LDRB Rd,[Rb,Ro] | ||
| 213 | 0xE19000F0 // LDRSH Rd,[Rb,Ro] | 201 | 0xE19000F0 // LDRSH Rd,[Rb,Ro] |
| 214 | }; | 202 | }; |
| 215 | *ainstr = subset[(tinstr & 0x0C00) >> 10] // base | 203 | |
| 216 | |((tinstr & 0x0007) << (12 - 0)) // Rd | 204 | *ainstr = subset[(tinstr & 0xE00) >> 9] // base |
| 217 | |((tinstr & 0x0038) << (16 - 3)) // Rb | 205 | |((tinstr & 0x0007) << (12 - 0)) // Rd |
| 218 | |((tinstr & 0x01C0) >> 6); // Ro | 206 | |((tinstr & 0x0038) << (16 - 3)) // Rb |
| 207 | |((tinstr & 0x01C0) >> 6); // Ro | ||
| 219 | } | 208 | } |
| 220 | break; | 209 | break; |
| 221 | 210 | ||
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index c56475ae4..4af168bfc 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -496,6 +496,52 @@ static void TriggerCmdReqQueue(Service::Interface* self) { | |||
| 496 | cmd_buff[1] = 0; // No error | 496 | cmd_buff[1] = 0; // No error |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | /** | ||
| 500 | * GSP_GPU::ImportDisplayCaptureInfo service function | ||
| 501 | * | ||
| 502 | * Returns information about the current framebuffer state | ||
| 503 | * | ||
| 504 | * Inputs: | ||
| 505 | * 0: Header 0x00180000 | ||
| 506 | * Outputs: | ||
| 507 | * 1: Result code | ||
| 508 | * 2: Left framebuffer virtual address for the main screen | ||
| 509 | * 3: Right framebuffer virtual address for the main screen | ||
| 510 | * 4: Main screen framebuffer format | ||
| 511 | * 5: Main screen framebuffer width | ||
| 512 | * 6: Left framebuffer virtual address for the bottom screen | ||
| 513 | * 7: Right framebuffer virtual address for the bottom screen | ||
| 514 | * 8: Bottom screen framebuffer format | ||
| 515 | * 9: Bottom screen framebuffer width | ||
| 516 | */ | ||
| 517 | static void ImportDisplayCaptureInfo(Service::Interface* self) { | ||
| 518 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 519 | |||
| 520 | // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0, | ||
| 521 | // because we only support a single running application at a time. | ||
| 522 | // This should always return the framebuffer data that is currently displayed on the screen. | ||
| 523 | |||
| 524 | u32 thread_id = 0; | ||
| 525 | |||
| 526 | FrameBufferUpdate* top_screen = GetFrameBufferInfo(thread_id, 0); | ||
| 527 | FrameBufferUpdate* bottom_screen = GetFrameBufferInfo(thread_id, 1); | ||
| 528 | |||
| 529 | cmd_buff[2] = top_screen->framebuffer_info[top_screen->index].address_left; | ||
| 530 | cmd_buff[3] = top_screen->framebuffer_info[top_screen->index].address_right; | ||
| 531 | cmd_buff[4] = top_screen->framebuffer_info[top_screen->index].format; | ||
| 532 | cmd_buff[5] = top_screen->framebuffer_info[top_screen->index].stride; | ||
| 533 | |||
| 534 | cmd_buff[6] = bottom_screen->framebuffer_info[bottom_screen->index].address_left; | ||
| 535 | cmd_buff[7] = bottom_screen->framebuffer_info[bottom_screen->index].address_right; | ||
| 536 | cmd_buff[8] = bottom_screen->framebuffer_info[bottom_screen->index].format; | ||
| 537 | cmd_buff[9] = bottom_screen->framebuffer_info[bottom_screen->index].stride; | ||
| 538 | |||
| 539 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 540 | |||
| 541 | LOG_WARNING(Service_GSP, "called"); | ||
| 542 | } | ||
| 543 | |||
| 544 | |||
| 499 | const Interface::FunctionInfo FunctionTable[] = { | 545 | const Interface::FunctionInfo FunctionTable[] = { |
| 500 | {0x00010082, WriteHWRegs, "WriteHWRegs"}, | 546 | {0x00010082, WriteHWRegs, "WriteHWRegs"}, |
| 501 | {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"}, | 547 | {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"}, |
| @@ -520,7 +566,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 520 | {0x00150002, nullptr, "TryAcquireRight"}, | 566 | {0x00150002, nullptr, "TryAcquireRight"}, |
| 521 | {0x00160042, nullptr, "AcquireRight"}, | 567 | {0x00160042, nullptr, "AcquireRight"}, |
| 522 | {0x00170000, nullptr, "ReleaseRight"}, | 568 | {0x00170000, nullptr, "ReleaseRight"}, |
| 523 | {0x00180000, nullptr, "ImportDisplayCaptureInfo"}, | 569 | {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"}, |
| 524 | {0x00190000, nullptr, "SaveVramSysArea"}, | 570 | {0x00190000, nullptr, "SaveVramSysArea"}, |
| 525 | {0x001A0000, nullptr, "RestoreVramSysArea"}, | 571 | {0x001A0000, nullptr, "RestoreVramSysArea"}, |
| 526 | {0x001B0000, nullptr, "ResetGpuCore"}, | 572 | {0x001B0000, nullptr, "ResetGpuCore"}, |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 2d2133b2e..feac53816 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -58,7 +58,7 @@ void Update() { | |||
| 58 | 58 | ||
| 59 | mem->pad.current_state.hex = state.hex; | 59 | mem->pad.current_state.hex = state.hex; |
| 60 | mem->pad.index = next_pad_index; | 60 | mem->pad.index = next_pad_index; |
| 61 | ++next_touch_index %= mem->pad.entries.size(); | 61 | next_touch_index = (next_touch_index + 1) % mem->pad.entries.size(); |
| 62 | 62 | ||
| 63 | // Get the previous Pad state | 63 | // Get the previous Pad state |
| 64 | u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); | 64 | u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); |
| @@ -88,7 +88,7 @@ void Update() { | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | mem->touch.index = next_touch_index; | 90 | mem->touch.index = next_touch_index; |
| 91 | ++next_touch_index %= mem->touch.entries.size(); | 91 | next_touch_index = (next_touch_index + 1) % mem->touch.entries.size(); |
| 92 | 92 | ||
| 93 | // Get the current touch entry | 93 | // Get the current touch entry |
| 94 | TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index]; | 94 | TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index]; |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 347d241f9..ca3ff3328 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -654,6 +654,8 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 | |||
| 654 | using Kernel::MemoryPermission; | 654 | using Kernel::MemoryPermission; |
| 655 | SharedPtr<SharedMemory> shared_memory = SharedMemory::Create(size, | 655 | SharedPtr<SharedMemory> shared_memory = SharedMemory::Create(size, |
| 656 | (MemoryPermission)my_permission, (MemoryPermission)other_permission); | 656 | (MemoryPermission)my_permission, (MemoryPermission)other_permission); |
| 657 | // Map the SharedMemory to the specified address | ||
| 658 | shared_memory->base_address = addr; | ||
| 657 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(shared_memory))); | 659 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(shared_memory))); |
| 658 | 660 | ||
| 659 | LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr); | 661 | LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr); |