Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 25691af

Browse files
authored
Merge pull request #1764 from reicast/skmp/oopify-2
OOPIFY: Part Two - AICA refactors - DSP implementations w/ dynamic switching (arm64, x86) - ARM7 implementations w/ dynamic switching (virt: arm32, arm64, x86)
2 parents 08579ee + 5985409 commit 25691af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+6228
-5583
lines changed

libswirl/build.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
//DC : 16 mb ram, 8 mb vram, 2 mb aram, 2 mb bios, 128k flash
348348
#define RAM_SIZE (16*1024*1024)
349349
#define VRAM_SIZE (8*1024*1024)
350-
#define ARAM_SIZE (2*1024*1024)
350+
#define INTERNAL_ARAM_SIZE (2*1024*1024)
351351
#define BIOS_SIZE (2*1024*1024)
352352
#define FLASH_SIZE (128*1024)
353353

@@ -362,7 +362,7 @@
362362
//Devkit : 32 mb ram, 8? mb vram, 2? mb aram, 2? mb bios, ? flash
363363
#define RAM_SIZE (32*1024*1024)
364364
#define VRAM_SIZE (8*1024*1024)
365-
#define ARAM_SIZE (2*1024*1024)
365+
#define INTERNAL_ARAM_SIZE (2*1024*1024)
366366
#define BIOS_SIZE (2*1024*1024)
367367
#define FLASH_SIZE (128*1024)
368368

@@ -375,7 +375,7 @@
375375
//Naomi : 32 mb ram, 16 mb vram, 8 mb aram, 2 mb bios, ? flash
376376
#define RAM_SIZE (32*1024*1024)
377377
#define VRAM_SIZE (16*1024*1024)
378-
#define ARAM_SIZE (8*1024*1024)
378+
#define INTERNAL_ARAM_SIZE (8*1024*1024)
379379
#define BIOS_SIZE (2*1024*1024)
380380
#define BBSRAM_SIZE (32*1024)
381381

@@ -388,7 +388,7 @@
388388
//Naomi2 : 32 mb ram, 16 mb vram, 8 mb aram, 2 mb bios, ? flash
389389
#define RAM_SIZE (32*1024*1024)
390390
#define VRAM_SIZE (16*1024*1024)
391-
#define ARAM_SIZE (8*1024*1024)
391+
#define INTERNAL_ARAM_SIZE (8*1024*1024)
392392
#define BIOS_SIZE (2*1024*1024)
393393
#define BBSRAM_SIZE (32*1024)
394394

@@ -403,7 +403,7 @@
403403
//Atomiswave : 16 mb ram, 8 mb vram, 8 mb aram, 128kb bios on flash, 128kb battery-backed ram
404404
#define RAM_SIZE (16*1024*1024)
405405
#define VRAM_SIZE (8*1024*1024)
406-
#define ARAM_SIZE (8*1024*1024)
406+
#define INTERNAL_ARAM_SIZE (8*1024*1024)
407407
#define BIOS_SIZE (128*1024)
408408
#define BBSRAM_SIZE (128*1024)
409409

@@ -417,7 +417,6 @@
417417

418418
#define RAM_MASK (RAM_SIZE-1)
419419
#define VRAM_MASK (VRAM_SIZE-1)
420-
#define ARAM_MASK (ARAM_SIZE-1)
421420
#define BIOS_MASK (BIOS_SIZE-1)
422421

423422
#ifdef FLASH_SIZE

libswirl/core.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ifdef X64_REC
4141
endif
4242

4343
ifdef ARM32_REC
44-
RZDCY_MODULES += jit/backend/arm32/ jit/emitter/arm/
44+
RZDCY_MODULES += jit/backend/arm32/ jit/emitter/arm/ deps/vixl/ deps/vixl/aarch32/
4545
endif
4646

4747
ifdef ARM64_REC

libswirl/deps/vixl/aarch32/assembler-aarch32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Assembler : public internal::AssemblerBase {
4343
bool allow_unpredictable_;
4444
bool allow_strongly_discouraged_;
4545

46-
protected:
46+
public:
4747
void EmitT32_16(uint16_t instr);
4848
void EmitT32_32(uint32_t instr);
4949
void EmitA32(uint32_t instr);

libswirl/deps/vixl/aarch32/macro-assembler-aarch32.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,19 @@ class MacroAssembler : public Assembler, public MacroAssemblerInterface {
411411
pool_manager_.Bind(this, label, GetCursorOffset());
412412
}
413413

414+
// ADDED for REICAST -- allows to bind external functions
415+
void BindToOffset(Label* label, ptrdiff_t offset) {
416+
// Assert that we have the correct buffer alignment.
417+
if (IsUsingT32()) {
418+
VIXL_ASSERT(GetBuffer()->Is16bitAligned());
419+
}
420+
else {
421+
VIXL_ASSERT(GetBuffer()->Is32bitAligned());
422+
}
423+
424+
pool_manager_.Bind(this, label, offset);
425+
}
426+
414427
void RegisterLiteralReference(RawLiteral* literal) {
415428
if (literal->IsManuallyPlaced()) return;
416429
RegisterForwardReference(literal);

libswirl/deps/vixl/code-buffer-vixl.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extern "C" {
3030

3131
#include "code-buffer-vixl.h"
3232
#include "utils-vixl.h"
33+
#include <string.h>
3334

3435
namespace vixl {
3536

@@ -103,12 +104,13 @@ void CodeBuffer::SetWritable() {
103104
}
104105
#endif
105106

106-
107+
// MODIFIED FOR REICAST // ANDROID armhf build
107108
void CodeBuffer::EmitString(const char* string) {
108109
VIXL_ASSERT(HasSpaceFor(strlen(string) + 1));
109110
char* dst = reinterpret_cast<char*>(cursor_);
110111
dirty_ = true;
111-
char* null_char = stpcpy(dst, string);
112+
//char* null_char = stpcpy(dst, string);
113+
char* null_char = strcpy(dst, string) + strlen(string);
112114
cursor_ = reinterpret_cast<byte*>(null_char) + 1;
113115
}
114116

libswirl/deps/vixl/globals-vixl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ inline void USE(const T1&, const T2&, const T3&, const T4&) {}
271271
#define VIXL_INCLUDE_TARGET_AARCH64
272272
#endif
273273

274+
#define VIXL_INCLUDE_TARGET_A32
275+
274276
#if defined(VIXL_INCLUDE_TARGET_A32) && defined(VIXL_INCLUDE_TARGET_T32)
275277
#define VIXL_INCLUDE_TARGET_AARCH32
276278
#elif defined(VIXL_INCLUDE_TARGET_A32)

libswirl/deps/vixl/pool-manager-impl.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,18 @@ T PoolManager<T>::Bind(MacroAssemblerInterface* masm,
452452
min_location = existing_object->min_location_;
453453
}
454454

455-
// Align if needed, and add necessary padding to reach the min_location_.
456-
T aligned_location = AlignUp(location, alignment);
457-
masm->EmitNopBytes(aligned_location - location);
458-
location = aligned_location;
459-
while (location < min_location) {
460-
masm->EmitNopBytes(alignment);
461-
location += alignment;
455+
// hack-fix for negative offsets when aligned
456+
if (alignment != 1) {
457+
// Align if needed, and add necessary padding to reach the min_location_.
458+
T aligned_location = AlignUp(location, alignment);
459+
masm->EmitNopBytes(aligned_location - location);
460+
location = aligned_location;
461+
while (location < min_location) {
462+
masm->EmitNopBytes(alignment);
463+
location += alignment;
464+
}
462465
}
463-
466+
464467
object->SetLocation(masm->AsAssemblerBase(), location);
465468
object->MarkBound();
466469

libswirl/gui/gui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ struct ReicastUI_impl : GUI {
557557
// Exit to main menu
558558
gui_state = Main;
559559
game_started = false;
560-
virtualDreamcast.release();
560+
virtualDreamcast.reset();
561561

562562
cfgSetVirtual("config", "image", "");
563563
}
@@ -717,7 +717,7 @@ struct ReicastUI_impl : GUI {
717717
{
718718
gui_state = Main;
719719
game_started = false;
720-
virtualDreamcast.release();
720+
virtualDreamcast.reset();
721721

722722
cfgSetVirtual("config", "image", "");
723723
switch (rc) {

libswirl/gui/gui_settings_advanced.cpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ void gui_settings_advanced()
1010
if (ImGui::BeginTabItem("Advanced"))
1111
{
1212
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding);
13-
if (ImGui::CollapsingHeader("CPU Mode", ImGuiTreeNodeFlags_DefaultOpen))
13+
if (ImGui::CollapsingHeader("MCPU Mode", ImGuiTreeNodeFlags_DefaultOpen))
1414
{
15-
ImGui::Columns(2, "cpu_modes", false);
16-
ImGui::RadioButton("Dynarec", &dynarec_enabled, 1);
15+
ImGui::Columns(2, "sh4_modes", false);
16+
ImGui::RadioButton("MCPU Dynarec", &dynarec_enabled, 1);
1717
ImGui::SameLine();
1818
gui_ShowHelpMarker("Use the dynamic recompiler. Recommended in most cases");
1919
ImGui::NextColumn();
20-
ImGui::RadioButton("Interpreter", &dynarec_enabled, 0);
20+
ImGui::RadioButton("MCPU Interpreter", &dynarec_enabled, 0);
2121
ImGui::SameLine();
2222
gui_ShowHelpMarker("Use the interpreter. Very slow but may help in case of a dynarec problem");
2323
ImGui::Columns(1, NULL, false);
2424
}
25-
if (ImGui::CollapsingHeader("Dynarec Options", dynarec_enabled ? ImGuiTreeNodeFlags_DefaultOpen : ImGuiTreeNodeFlags_None))
25+
if (ImGui::CollapsingHeader("SH4 Dynarec Options", dynarec_enabled ? ImGuiTreeNodeFlags_DefaultOpen : ImGuiTreeNodeFlags_None))
2626
{
2727
ImGui::Checkbox("Safe Mode", &settings.dynarec.safemode);
2828
ImGui::SameLine();
@@ -57,7 +57,31 @@ void gui_settings_advanced()
5757
ImGui::SameLine();
5858
gui_ShowHelpMarker("How to detect self-modifying code. Full check recommended");
5959
}
60-
if (ImGui::CollapsingHeader("Other", ImGuiTreeNodeFlags_DefaultOpen))
60+
if (ImGui::CollapsingHeader("SCPU Mode", ImGuiTreeNodeFlags_DefaultOpen))
61+
{
62+
ImGui::Columns(2, "arm7_modes", false);
63+
ImGui::RadioButton("SCPU Dynarec", &settings.dynarec.ScpuEnable, 1);
64+
ImGui::SameLine();
65+
gui_ShowHelpMarker("Use the ARM7 dynamic recompiler. Recommended in most cases");
66+
ImGui::NextColumn();
67+
ImGui::RadioButton("SCPU Interpreter", &settings.dynarec.ScpuEnable, 0);
68+
ImGui::SameLine();
69+
gui_ShowHelpMarker("Use the ARM7 interpreter. Very slow but may help in case of a dynarec problem");
70+
ImGui::Columns(1, NULL, false);
71+
}
72+
if (ImGui::CollapsingHeader("DSP Mode", ImGuiTreeNodeFlags_DefaultOpen))
73+
{
74+
ImGui::Columns(2, "dsp_modes", false);
75+
ImGui::RadioButton("DSP Dynarec", &settings.dynarec.DspEnable, 1);
76+
ImGui::SameLine();
77+
gui_ShowHelpMarker("Use the DSP dynamic recompiler. Recommended in most cases");
78+
ImGui::NextColumn();
79+
ImGui::RadioButton("DSP Interpreter", &settings.dynarec.DspEnable, 0);
80+
ImGui::SameLine();
81+
gui_ShowHelpMarker("Use the DSP interpreter. Very slow but may help in case of a DSP dynarec problem");
82+
ImGui::Columns(1, NULL, false);
83+
}
84+
if (ImGui::CollapsingHeader("Other", ImGuiTreeNodeFlags_DefaultOpen))
6185
{
6286
#ifndef _ANDROID
6387
ImGui::Checkbox("Serial Console", &settings.debug.SerialConsole);

0 commit comments

Comments
 (0)