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

Commit 95f4c8e

Browse files
authored
Merge pull request #1528 from reicast/fh/android-wipeout
Removing most of the java code and various bug fixes
2 parents 7335b35 + 36acae9 commit 95f4c8e

File tree

177 files changed

+420
-9016
lines changed

Some content is hidden

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

177 files changed

+420
-9016
lines changed

core/build.h

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,6 @@
286286
#define FEAT_HAS_SOFTREND BUILD_COMPILER == COMPILER_VC //GCC wants us to enable sse4 globaly to enable intrins
287287
#endif
288288

289-
#define RAM_SIZE_MAX (32*1024*1024)
290-
#define VRAM_SIZE_MAX (16*1024*1024)
291-
#define ARAM_SIZE_MAX (8*1024*1024)
292-
293289
//Depricated build configs
294290
#ifdef HOST_NO_REC
295291
#error Dont use HOST_NO_REC
@@ -298,3 +294,108 @@
298294
#ifdef HOST_NO_AREC
299295
#error Dont use HOST_NO_AREC
300296
#endif
297+
298+
// TARGET PLATFORM
299+
300+
#define RAM_SIZE_MAX (32*1024*1024)
301+
#define VRAM_SIZE_MAX (16*1024*1024)
302+
#define ARAM_SIZE_MAX (8*1024*1024)
303+
304+
#if (DC_PLATFORM==DC_PLATFORM_DREAMCAST)
305+
306+
#define BUILD_DREAMCAST 1
307+
308+
//DC : 16 mb ram, 8 mb vram, 2 mb aram, 2 mb bios, 128k flash
309+
#define RAM_SIZE (16*1024*1024)
310+
#define VRAM_SIZE (8*1024*1024)
311+
#define ARAM_SIZE (2*1024*1024)
312+
#define BIOS_SIZE (2*1024*1024)
313+
#define FLASH_SIZE (128*1024)
314+
315+
#define ROM_PREFIX "dc_"
316+
#define ROM_NAMES
317+
#define NVR_OPTIONAL 0
318+
319+
#elif (DC_PLATFORM==DC_PLATFORM_DEV_UNIT)
320+
321+
#define BUILD_DEV_UNIT 1
322+
323+
//Devkit : 32 mb ram, 8? mb vram, 2? mb aram, 2? mb bios, ? flash
324+
#define RAM_SIZE (32*1024*1024)
325+
#define VRAM_SIZE (8*1024*1024)
326+
#define ARAM_SIZE (2*1024*1024)
327+
#define BIOS_SIZE (2*1024*1024)
328+
#define FLASH_SIZE (128*1024)
329+
330+
#define ROM_PREFIX "hkt_"
331+
#define ROM_NAMES
332+
#define NVR_OPTIONAL 0
333+
334+
#elif (DC_PLATFORM==DC_PLATFORM_NAOMI)
335+
336+
//Naomi : 32 mb ram, 16 mb vram, 8 mb aram, 2 mb bios, ? flash
337+
#define RAM_SIZE (32*1024*1024)
338+
#define VRAM_SIZE (16*1024*1024)
339+
#define ARAM_SIZE (8*1024*1024)
340+
#define BIOS_SIZE (2*1024*1024)
341+
#define BBSRAM_SIZE (32*1024)
342+
343+
#define ROM_PREFIX "naomi_"
344+
#define ROM_NAMES ";epr-21576d.bin"
345+
#define NVR_OPTIONAL 1
346+
347+
#elif (DC_PLATFORM==DC_PLATFORM_NAOMI2)
348+
349+
//Naomi2 : 32 mb ram, 16 mb vram, 8 mb aram, 2 mb bios, ? flash
350+
#define RAM_SIZE (32*1024*1024)
351+
#define VRAM_SIZE (16*1024*1024)
352+
#define ARAM_SIZE (8*1024*1024)
353+
#define BIOS_SIZE (2*1024*1024)
354+
#define BBSRAM_SIZE (32*1024)
355+
356+
#define ROM_PREFIX "n2_"
357+
#define ROM_NAMES
358+
#define NVR_OPTIONAL 1
359+
360+
#elif (DC_PLATFORM==DC_PLATFORM_ATOMISWAVE)
361+
362+
#define BUILD_ATOMISWAVE 1
363+
364+
//Atomiswave : 16 mb ram, 8 mb vram, 8 mb aram, 128kb bios on flash, 128kb battery-backed ram
365+
#define RAM_SIZE (16*1024*1024)
366+
#define VRAM_SIZE (8*1024*1024)
367+
#define ARAM_SIZE (8*1024*1024)
368+
#define BIOS_SIZE (128*1024)
369+
#define BBSRAM_SIZE (128*1024)
370+
371+
#define ROM_PREFIX "aw_"
372+
#define ROM_NAMES ";bios.ic23_l"
373+
#define NVR_OPTIONAL 1
374+
375+
#else
376+
#error invalid build config
377+
#endif
378+
379+
#define RAM_MASK (RAM_SIZE-1)
380+
#define VRAM_MASK (VRAM_SIZE-1)
381+
#define ARAM_MASK (ARAM_SIZE-1)
382+
#define BIOS_MASK (BIOS_SIZE-1)
383+
384+
#ifdef FLASH_SIZE
385+
#define FLASH_MASK (FLASH_SIZE-1)
386+
#endif
387+
388+
#ifdef BBSRAM_SIZE
389+
#define BBSRAM_MASK (BBSRAM_SIZE-1)
390+
#endif
391+
392+
#define GD_CLOCK 33868800 //GDROM XTAL -- 768fs
393+
394+
#define AICA_CORE_CLOCK (GD_CLOCK*4/3) //[45158400] GD->PLL 3:4 -> AICA CORE -- 1024fs
395+
#define ADAC_CLOCK (AICA_CORE_CLOCK/2) //[11289600] 44100*256, AICA CORE -> PLL 4:1 -> ADAC -- 256fs
396+
#define AICA_ARM_CLOCK (AICA_CORE_CLOCK/2) //[22579200] AICA CORE -> PLL 2:1 -> ARM
397+
#define AICA_SDRAM_CLOCK (GD_CLOCK*2) //[67737600] GD-> PLL 2 -> SDRAM
398+
#define SH4_MAIN_CLOCK (200*1000*1000) //[200000000] XTal(13.5) -> PLL (33.3) -> PLL 1:6 (200)
399+
#define SH4_RAM_CLOCK (100*1000*1000) //[100000000] XTal(13.5) -> PLL (33.3) -> PLL 1:3 (100) , also suplied to HOLLY chip
400+
#define G2_BUS_CLOCK (25*1000*1000) //[25000000] from Holly, from SH4_RAM_CLOCK w/ 2 2:1 plls
401+

core/hw/arm7/arm64.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,13 @@ __asm__ (
499499
".hidden arm_dispatch \n"
500500
"arm_dispatch: \n\t"
501501
"ldp w0, w1, [x28, #184] \n\t" // load Next PC, interrupt
502-
503-
"ubfx w2, w0, #2, #21 \n\t" // w2 = pc >> 2. Note: assuming address space <= 8 MB (23 bits)
502+
#if ARAM_SIZE == 2*1024*1024
503+
"ubfx w2, w0, #2, #19 \n\t" // w2 = pc >> 2. Note: assuming address space == 2 MB (21 bits)
504+
#elif ARAM_SIZE == 8*1024*1024
505+
"ubfx w2, w0, #2, #21 \n\t" // w2 = pc >> 2. Note: assuming address space == 8 MB (23 bits)
506+
#else
507+
#error Unsupported AICA RAM size
508+
#endif
504509
"cbnz w1, arm_dofiq \n\t" // if interrupt pending, handle it
505510

506511
"add x2, x26, x2, lsl #3 \n\t" // x2 = EntryPoints + pc << 1

core/hw/gdrom/gdromv3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ void gd_set_state(gd_states state)
256256

257257
void gd_setdisc()
258258
{
259+
cdda.playing = false;
259260
DiscType newd = (DiscType)libGDR_GetDiscType();
260261

261262
switch(newd)

core/imgread/gdi.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
#include <sstream>
44
#include <algorithm>
55

6+
// On windows, transform / to \\
7+
8+
string normalize_path_separator(string path)
9+
{
10+
#if HOST_OS == OS_WINDOWS
11+
std::replace(path.begin(), path.end(), '/', '\\');
12+
#endif
13+
14+
return path;
15+
}
16+
617
// given file/name.ext or file\name.ext returns file/ or file\, depending on the platform
718
// given name.ext returns ./ or .\, depending on the platform
819
string OS_dirname(string file)
920
{
21+
file = normalize_path_separator(file);
1022
#if HOST_OS == OS_WINDOWS
1123
const char sep = '\\';
1224
#else
@@ -25,19 +37,6 @@ string OS_dirname(string file)
2537
return file.substr(0, last_slash + 1);
2638
}
2739

28-
// On windows, transform / to \\
29-
// On linux, transform \\ to /
30-
string normalize_path_separator(string path)
31-
{
32-
#if HOST_OS == OS_WINDOWS
33-
std::replace( path.begin(), path.end(), '/', '\\');
34-
#else
35-
std::replace( path.begin(), path.end(), '\\', '/');
36-
#endif
37-
38-
return path;
39-
}
40-
4140
#if 0 // TODO: Move this to some tests, make it platform agnostic
4241
namespace {
4342
struct OS_dirname_Test {

core/input/gamepad.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ enum DreamcastKey
5353

5454
// System axes
5555
EMU_AXIS_NONE = 0x00000,
56-
EMU_AXIS_DPAD1_X = 0x00001,
57-
EMU_AXIS_DPAD1_Y = 0x00002,
58-
EMU_AXIS_DPAD2_X = 0x00003,
59-
EMU_AXIS_DPAD2_Y = 0x00004,
56+
EMU_AXIS_DPAD1_X = DC_DPAD_LEFT,
57+
EMU_AXIS_DPAD1_Y = DC_DPAD_UP,
58+
EMU_AXIS_DPAD2_X = DC_DPAD2_LEFT,
59+
EMU_AXIS_DPAD2_Y = DC_DPAD2_RIGHT,
6060
};

core/input/gamepad_device.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <limits.h>
2121
#include "gamepad_device.h"
2222
#include "rend/gui.h"
23+
#include "oslib/oslib.h"
2324

2425
extern void dc_exit();
2526

@@ -32,7 +33,8 @@ std::mutex GamepadDevice::_gamepads_mutex;
3233

3334
bool GamepadDevice::gamepad_btn_input(u32 code, bool pressed)
3435
{
35-
if (_input_detected != NULL && _detecting_button && pressed)
36+
if (_input_detected != NULL && _detecting_button
37+
&& os_GetSeconds() >= _detection_start_time && pressed)
3638
{
3739
_input_detected(code);
3840
_input_detected = NULL;
@@ -84,7 +86,8 @@ bool GamepadDevice::gamepad_axis_input(u32 code, int value)
8486
v = (get_axis_min_value(code) + get_axis_range(code) - value) * 255 / get_axis_range(code) - 128;
8587
else
8688
v = (value - get_axis_min_value(code)) * 255 / get_axis_range(code) - 128; //-128 ... + 127 range
87-
if (_input_detected != NULL && !_detecting_button && (v >= 64 || v <= -64))
89+
if (_input_detected != NULL && !_detecting_button
90+
&& os_GetSeconds() >= _detection_start_time && (v >= 64 || v <= -64))
8891
{
8992
_input_detected(code);
9093
_input_detected = NULL;
@@ -235,3 +238,18 @@ void UpdateVibration(u32 port, float power, float inclination, u32 duration_ms)
235238
gamepad->rumble(power, inclination, duration_ms);
236239
}
237240
}
241+
242+
void GamepadDevice::detect_btn_input(input_detected_cb button_pressed)
243+
{
244+
_input_detected = button_pressed;
245+
_detecting_button = true;
246+
_detection_start_time = os_GetSeconds() + 0.2;
247+
}
248+
249+
void GamepadDevice::detect_axis_input(input_detected_cb axis_moved)
250+
{
251+
_input_detected = axis_moved;
252+
_detecting_button = false;
253+
_detection_start_time = os_GetSeconds() + 0.2;
254+
}
255+

core/input/gamepad_device.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,8 @@ class GamepadDevice
3535
bool gamepad_axis_input(u32 code, int value);
3636
virtual ~GamepadDevice() {}
3737

38-
void detect_btn_input(input_detected_cb button_pressed)
39-
{
40-
_input_detected = button_pressed;
41-
_detecting_button = true;
42-
}
43-
void detect_axis_input(input_detected_cb axis_moved)
44-
{
45-
_input_detected = axis_moved;
46-
_detecting_button = false;
47-
}
38+
void detect_btn_input(input_detected_cb button_pressed);
39+
void detect_axis_input(input_detected_cb axis_moved);
4840
void cancel_detect_input()
4941
{
5042
_input_detected = NULL;
@@ -104,6 +96,7 @@ class GamepadDevice
10496
std::string _api_name;
10597
int _maple_port;
10698
bool _detecting_button = false;
99+
double _detection_start_time;
107100
input_detected_cb _input_detected;
108101
bool _remappable;
109102
float _dead_zone = 0.1f;

core/rec-ARM/ngen_arm.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ bkpt #0
5858
bkpt
5959
#endif
6060
ubfx r0,r3,#5,#19 @ get vram offset
61+
@ should be only 18 bits for 8MB VRAM but it wraps around on dc
6162
add r3,r1,#0x04000000 @ get vram ptr from r1, part 1
6263
add r3,#512 @ get ram ptr from r1, part 2
6364
add r3,r0,lsl #5 @ ram + offset
@@ -180,6 +181,7 @@ CSYM(no_update): @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore*
180181
#if RAM_SIZE_MAX == 33554432
181182
sub r2,r8,#0x4100000
182183
ubfx r1,r4,#1,#24 @ 24+1 bits: 32 MB
184+
@ RAM wraps around so if actual RAM size is 16MB, we won't overflow
183185
#elif RAM_SIZE_MAX == 16777216
184186
sub r2,r8,#0x2100000
185187
ubfx r1,r4,#1,#23 @ 23+1 bits: 16 MB
@@ -241,7 +243,13 @@ HIDDEN(arm_dispatch)
241243
CSYM(arm_dispatch):
242244
ldrd r0,r1,[r8,#184] @load: Next PC, interrupt
243245

246+
#if ARAM_SIZE == 2*1024*1024
247+
ubfx r2,r0,#2,#19 @ assuming 2 MB address space max (21 bits)
248+
#elif ARAM_SIZE == 8*1024*1024
244249
ubfx r2,r0,#2,#21 @ assuming 8 MB address space max (23 bits)
250+
#else
251+
#error Unsupported AICA RAM size
252+
#endif
245253
cmp r1,#0
246254
bne arm_dofiq
247255

core/rec-ARM64/rec_arm64.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -617,31 +617,25 @@ class Arm64Assembler : public MacroAssembler
617617
break;
618618

619619
case shop_pref:
620-
Mov(w0, regalloc.MapRegister(op.rs1));
621-
if (op.flags != 0x1337)
622620
{
623621
Lsr(w1, regalloc.MapRegister(op.rs1), 26);
624622
Cmp(w1, 0x38);
625-
}
623+
Label not_sqw;
624+
B(&not_sqw, ne);
625+
Mov(w0, regalloc.MapRegister(op.rs1));
626626

627-
if (CCN_MMUCR.AT)
628-
{
629-
Ldr(x9, reinterpret_cast<uintptr_t>(&do_sqw_mmu));
630-
}
631-
else
632-
{
633-
Sub(x9, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, do_sqw_nommu));
634-
Ldr(x9, MemOperand(x9));
635-
Sub(x1, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, sq_buffer));
636-
}
637-
if (op.flags == 0x1337)
638-
Blr(x9);
639-
else
640-
{
641-
Label no_branch;
642-
B(&no_branch, ne);
627+
if (CCN_MMUCR.AT)
628+
{
629+
Ldr(x9, reinterpret_cast<uintptr_t>(&do_sqw_mmu));
630+
}
631+
else
632+
{
633+
Sub(x9, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, do_sqw_nommu));
634+
Ldr(x9, MemOperand(x9));
635+
Sub(x1, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, sq_buffer));
636+
}
643637
Blr(x9);
644-
Bind(&no_branch);
638+
Bind(&not_sqw);
645639
}
646640
break;
647641

core/rend/gui.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,3 +1488,10 @@ int msgboxf(const wchar* text, unsigned int type, ...) {
14881488
return 1;
14891489
}
14901490

1491+
extern bool subfolders_read;
1492+
1493+
void gui_refresh_files()
1494+
{
1495+
game_list_done = false;
1496+
subfolders_read = false;
1497+
}

0 commit comments

Comments
 (0)