added ntscu-u support
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/* NTSC-U (SCUS_971.99) only: library functions the PAL game does not have.
|
||||
* Written in US addresses; tools/region.py copies this folder into the US
|
||||
* host tree as it is (no rewriting) and the PAL build never sees it. */
|
||||
#include "uya_host.h"
|
||||
#include "uya_runtime.h"
|
||||
|
||||
s32 rac1_mc_chdir(s32 port, s32 slot, const char *dir, char *prev);
|
||||
|
||||
/* 0x001240C0: sceMcChdir(port, slot, newDir, curDir), RPC 0x0C (its sync
|
||||
* callback 0x00124038 copies the previous directory into curDir) */
|
||||
s32 func_001240C0(s32 port, s32 slot, char *dir, char *cur) { return rac1_mc_chdir(port, slot, dir, cur); }
|
||||
@@ -107,7 +107,7 @@ s32 func_00118E70(s32 reg) { (void)reg; return 0x00070000; } /* sceSifGe
|
||||
* game sends the data with sceSifSetDma (above). Without it every stash
|
||||
* slot was refused (size 0) and the pause menu unpacked the weapon data
|
||||
* from a scrubbed buffer (a crash reading 0xDEE6BEEF). ---------- */
|
||||
#define STASH_BASE 0x00160000u
|
||||
#define STASH_BASE 0x00160000u /* an IOP address (region:keep) */
|
||||
#define STASH_SIZE 0x00094000u
|
||||
void func_0011AE20(s32 mode) { (void)mode; } /* sceSifInitRpc */
|
||||
s32 func_0011B2F8(void *cd, u32 server, s32 mode) /* sceSifBindRpc */
|
||||
|
||||
@@ -144,7 +144,7 @@ const char *rc_stack_scan(void)
|
||||
t[0] = 0;
|
||||
for (int i = 0; sp && i < 1024 && k < 12; i += 2) {
|
||||
u32 v = sp[i];
|
||||
if (v >= 0x00112380u && v < 0x00300000u && !(v & 3) && (v & 0xFFFF) && v != 0x00160000u && v != 0x00170000u) {
|
||||
if (v >= 0x00112380u && v < 0x00300000u && !(v & 3) && (v & 0xFFFF) && v != 0x00160000u && v != 0x00170000u) { /* region:keep */
|
||||
n += snprintf(t + n, sizeof t - n, " %08X@%d", v, i * 4); k++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ static u32 bank_add(const u8 *src, u32 size)
|
||||
b->nsounds = (s16)rd16(b->sblk + 0x16);
|
||||
b->first_sound = rd32(b->sblk + 0x1C);
|
||||
b->first_grain = rd32(b->sblk + 0x20);
|
||||
b->handle = 0x00120000u + (u32)i * 0x1000u + ((++bank_serial) & 0xFFF);
|
||||
b->handle = 0x00120000u + (u32)i * 0x1000u + ((++bank_serial) & 0xFFF); /* region:keep */
|
||||
if (rd32(b->sblk + 4) != 1) uya_log("989snd: SBlk version %u (only 1 is expected)", rd32(b->sblk + 4));
|
||||
uya_log("989snd: bank %08X loaded: %d sounds, %u KB of samples", b->handle, b->nsounds, b->smp_size / 1024);
|
||||
if (snd_log > 0 && getenv("UYA_DUMP")) { /* for checking: the bank as loaded */
|
||||
|
||||
@@ -96,11 +96,15 @@ static int glob_match(const char *p, const char *s)
|
||||
/* Card path ("/DIR/file" or "DIR/file") to a host path. Wildcards in the
|
||||
* directory part pick the first directory that matches. Returns 0 if a
|
||||
* wildcard directory had no match. */
|
||||
static char mc_cwd[2][512] = {"/", "/"}; /* sceMcChdir's current directory (the NTSC-U game sets it) */
|
||||
static int host_path(int port, const char *name, char *out, size_t n, char *last, size_t nlast)
|
||||
{
|
||||
char tmp[512], cur[1024];
|
||||
snprintf(cur, sizeof cur, "%s", slot_dir(port));
|
||||
snprintf(tmp, sizeof tmp, "%s", name ? name : "");
|
||||
if (name && name[0] != '/' && strcmp(mc_cwd[port & 1], "/"))
|
||||
snprintf(tmp, sizeof tmp, "%s/%s", mc_cwd[port & 1], name); /* relative to the current directory */
|
||||
else
|
||||
snprintf(tmp, sizeof tmp, "%s", name ? name : "");
|
||||
char *parts[16]; int np = 0;
|
||||
for (char *t = strtok(tmp, "/"); t && np < 16; t = strtok(0, "/")) parts[np++] = t;
|
||||
for (int i = 0; i < np - 1; i++) {
|
||||
@@ -177,6 +181,32 @@ s32 uyafn_12E400(s32 port, s32 slot, s32 *type, s32 *free_kb, s32 *format)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* sceMcChdir(port, slot, new, cur*) (RPC 0x0C): the card's current directory
|
||||
* for relative names; cur, if given, gets the previous one. PAL's game never
|
||||
* calls it; NTSC-U's sets "/" before listing (host/region/us maps it). */
|
||||
s32 rac1_mc_chdir(s32 port, s32 slot, const char *dir, char *prev)
|
||||
{
|
||||
(void)slot;
|
||||
if (mclog()) uya_log("memory card: chdir %s", dir ? dir : "(null)");
|
||||
if (!card_present(port)) { finish(0xC, -10); return 0; }
|
||||
if (prev) snprintf(prev, 1024, "%s", mc_cwd[port & 1]);
|
||||
char want[512];
|
||||
if (!dir || !*dir) { finish(0xC, 0); return 0; }
|
||||
if (dir[0] == '/') snprintf(want, sizeof want, "%s", dir);
|
||||
else if (!strcmp(dir, "..")) {
|
||||
snprintf(want, sizeof want, "%s", mc_cwd[port & 1]);
|
||||
char *sl = strrchr(want, '/'); if (sl && sl != want) *sl = 0; else snprintf(want, sizeof want, "/");
|
||||
} else snprintf(want, sizeof want, "%s%s%s", mc_cwd[port & 1], strcmp(mc_cwd[port & 1], "/") ? "/" : "", dir);
|
||||
size_t l = strlen(want);
|
||||
while (l > 1 && want[l - 1] == '/') want[--l] = 0;
|
||||
char hp[1024];
|
||||
snprintf(hp, sizeof hp, "%s%s", slot_dir(port), want);
|
||||
if (!is_dir(hp)) { finish(0xC, -4); return 0; } /* no such directory */
|
||||
snprintf(mc_cwd[port & 1], sizeof mc_cwd[0], "%s", want);
|
||||
finish(0xC, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* sceMcGetDir table entry (sceMcTblGetDir), 0x40 bytes */
|
||||
typedef struct {
|
||||
u8 create[8], modify[8];
|
||||
|
||||
Reference in New Issue
Block a user