diff options
| -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) {      unsigned int inst, inst_size = 4;      int idx;      int ret = NON_BRANCH; -    int thumb = 0;      int size = 0; // instruction size of basic block      bb_start = top; -    if (cpu->TFlag) -        thumb = THUMB; -      u32 phys_addr = addr;      u32 pc_start = cpu->Reg[15]; -    while(ret == NON_BRANCH) { +    while (ret == NON_BRANCH) {          inst = Memory::Read32(phys_addr & 0xFFFFFFFC);          size++; @@ -3890,7 +3886,6 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {      #define CurrentModeHasSPSR (cpu->Mode != SYSTEM32MODE) && (cpu->Mode != USER32MODE)      #define PC (cpu->Reg[15]) -    #define CHECK_EXT_INT if (!cpu->NirqSig && !(cpu->Cpsr & 0x80)) goto END;      // GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback      // 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) {      case 10:      case 11: -        // TODO: Format 7 and Format 8 perform the same ARM encoding, so the following could be -        // merged into a single subset, saving on the following boolean: - -        if ((tinstr & (1 << 9)) == 0) { -            static const ARMword subset[4] = { -                0xE7800000, // STR  Rd,[Rb,Ro] -                0xE7C00000, // STRB Rd,[Rb,Ro] -                0xE7900000, // LDR  Rd,[Rb,Ro] -                0xE7D00000  // LDRB Rd,[Rb,Ro] -            }; - -            *ainstr = subset[(tinstr & 0x0C00) >> 10]   // base -                |((tinstr & 0x0007) << (12 - 0))        // Rd -                |((tinstr & 0x0038) << (16 - 3))        // Rb -                |((tinstr & 0x01C0) >> 6);              // Ro - -        } else { -            static const ARMword subset[4] = { +        { +            static const ARMword subset[8] = { +                0xE7800000, // STR   Rd,[Rb,Ro]                  0xE18000B0, // STRH  Rd,[Rb,Ro] +                0xE7C00000, // STRB  Rd,[Rb,Ro]                  0xE19000D0, // LDRSB Rd,[Rb,Ro] +                0xE7900000, // LDR   Rd,[Rb,Ro]                  0xE19000B0, // LDRH  Rd,[Rb,Ro] +                0xE7D00000, // LDRB  Rd,[Rb,Ro]                  0xE19000F0  // LDRSH Rd,[Rb,Ro]              }; -            *ainstr = subset[(tinstr & 0x0C00) >> 10]   // base -                |((tinstr & 0x0007) << (12 - 0))        // Rd -                |((tinstr & 0x0038) << (16 - 3))        // Rb -                |((tinstr & 0x01C0) >> 6);              // Ro + +            *ainstr = subset[(tinstr & 0xE00) >> 9] // base +                |((tinstr & 0x0007) << (12 - 0))    // Rd +                |((tinstr & 0x0038) << (16 - 3))    // Rb +                |((tinstr & 0x01C0) >> 6);          // Ro          }          break; 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) {      cmd_buff[1] = 0; // No error  } +/** + * GSP_GPU::ImportDisplayCaptureInfo service function + * + * Returns information about the current framebuffer state + * + *  Inputs: + *      0: Header 0x00180000 + *  Outputs: + *      1: Result code + *      2: Left framebuffer virtual address for the main screen + *      3: Right framebuffer virtual address for the main screen + *      4: Main screen framebuffer format + *      5: Main screen framebuffer width + *      6: Left framebuffer virtual address for the bottom screen + *      7: Right framebuffer virtual address for the bottom screen + *      8: Bottom screen framebuffer format + *      9: Bottom screen framebuffer width + */ +static void ImportDisplayCaptureInfo(Service::Interface* self) { +    u32* cmd_buff = Kernel::GetCommandBuffer(); +     +    // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0,  +    // because we only support a single running application at a time. +    // This should always return the framebuffer data that is currently displayed on the screen. + +    u32 thread_id = 0; + +    FrameBufferUpdate* top_screen = GetFrameBufferInfo(thread_id, 0); +    FrameBufferUpdate* bottom_screen = GetFrameBufferInfo(thread_id, 1); + +    cmd_buff[2] = top_screen->framebuffer_info[top_screen->index].address_left; +    cmd_buff[3] = top_screen->framebuffer_info[top_screen->index].address_right; +    cmd_buff[4] = top_screen->framebuffer_info[top_screen->index].format; +    cmd_buff[5] = top_screen->framebuffer_info[top_screen->index].stride; + +    cmd_buff[6] = bottom_screen->framebuffer_info[bottom_screen->index].address_left; +    cmd_buff[7] = bottom_screen->framebuffer_info[bottom_screen->index].address_right; +    cmd_buff[8] = bottom_screen->framebuffer_info[bottom_screen->index].format; +    cmd_buff[9] = bottom_screen->framebuffer_info[bottom_screen->index].stride; + +    cmd_buff[1] = RESULT_SUCCESS.raw; + +    LOG_WARNING(Service_GSP, "called"); +} + +  const Interface::FunctionInfo FunctionTable[] = {      {0x00010082, WriteHWRegs,                   "WriteHWRegs"},      {0x00020084, WriteHWRegsWithMask,           "WriteHWRegsWithMask"}, @@ -520,7 +566,7 @@ const Interface::FunctionInfo FunctionTable[] = {      {0x00150002, nullptr,                       "TryAcquireRight"},      {0x00160042, nullptr,                       "AcquireRight"},      {0x00170000, nullptr,                       "ReleaseRight"}, -    {0x00180000, nullptr,                       "ImportDisplayCaptureInfo"}, +    {0x00180000, ImportDisplayCaptureInfo,      "ImportDisplayCaptureInfo"},      {0x00190000, nullptr,                       "SaveVramSysArea"},      {0x001A0000, nullptr,                       "RestoreVramSysArea"},      {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() {      mem->pad.current_state.hex = state.hex;      mem->pad.index = next_pad_index; -    ++next_touch_index %= mem->pad.entries.size(); +    next_touch_index = (next_touch_index + 1) % mem->pad.entries.size();      // Get the previous Pad state      u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); @@ -88,7 +88,7 @@ void Update() {      }      mem->touch.index = next_touch_index; -    ++next_touch_index %= mem->touch.entries.size(); +    next_touch_index = (next_touch_index + 1) % mem->touch.entries.size();      // Get the current touch entry      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      using Kernel::MemoryPermission;      SharedPtr<SharedMemory> shared_memory = SharedMemory::Create(size,              (MemoryPermission)my_permission, (MemoryPermission)other_permission); +    // Map the SharedMemory to the specified address +    shared_memory->base_address = addr;      CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(shared_memory)));      LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr);  | 
