aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-12-23 22:09:06 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-12-23 22:09:06 +0100
commit2e6625481cd006d0a9d68285ce557f195030718e (patch)
tree5a65f290c20cde7a34ceb95fc40f0945ba5968d7
parent6c7512ff42805e9399dfee8b67e2f70fa55909d3 (diff)
downloadpsn00bsdk-2e6625481cd006d0a9d68285ce557f195030718e.tar.gz
Fix CdGetSector size inconsistency, update changelog
-rw-r--r--.github/scripts/generate_release_notes.py46
-rw-r--r--CHANGELOG.md29
-rw-r--r--examples/cdrom/cdxa/main.c2
-rw-r--r--examples/io/system573/main.c2
-rw-r--r--libpsn00b/psxcd/cdgetsector.s3
-rw-r--r--libpsn00b/psxcd/isofs.c2
-rw-r--r--libpsn00b/psxcd/psxcd.c8
7 files changed, 44 insertions, 48 deletions
diff --git a/.github/scripts/generate_release_notes.py b/.github/scripts/generate_release_notes.py
index f3e4870..e3fbc7f 100644
--- a/.github/scripts/generate_release_notes.py
+++ b/.github/scripts/generate_release_notes.py
@@ -3,7 +3,7 @@
# (C) 2021 spicyjpeg - MPL licensed
import sys, re
-from time import gmtime, strptime
+from time import gmtime, strptime, struct_time
from argparse import ArgumentParser, FileType
## Helpers
@@ -11,14 +11,13 @@ from argparse import ArgumentParser, FileType
VERSION_REGEX = re.compile(r"^(?:refs\/tags\/)?(?:v|ver|version|release)? *(.*)")
def parse_date(date):
+ if isinstance(date, struct_time):
+ return date
+
return strptime(date.strip(), "%Y-%m-%d")
def normalize_version(version):
- match = VERSION_REGEX.match(version.lower())
- if not match:
- raise ValueError(f"invalid version string: {version}")
-
- return match.group(1)
+ return VERSION_REGEX.match(version.lower()).group(1)
## Changelog parser
@@ -50,9 +49,6 @@ def parse_blocks(changelog):
# [ _crap, date, version, body, date, version, body, ... ]
items = BLOCK_REGEX.split(changelog.strip())
- #if items[0].strip():
- #raise RuntimeError("the changelog doesn't start with a valid block")
-
# Iterate over all blocks from bottom to top (i.e. oldest first).
last_version = FIRST_VERSION
@@ -110,51 +106,39 @@ def generate_notes(versions):
def get_args():
parser = ArgumentParser(
- description = "Generates and outputs release notes from a Markdown changelog file.",
- add_help = False
+ description = "Generates and outputs release notes from a Markdown changelog file."
)
-
- tools_group = parser.add_argument_group("Tools")
- tools_group.add_argument(
- "-h", "--help",
- action = "help",
- help = "Show this help message and exits"
- )
-
- files_group = parser.add_argument_group("Files")
- files_group.add_argument(
+ parser.add_argument(
"changelog",
type = FileType("rt"),
help = "Markdown changelog file to parse"
)
- files_group.add_argument(
+ parser.add_argument(
"-o", "--output",
type = FileType("wt"),
default = sys.stdout,
- help = "Where to output release notes (stdout by default)",
+ help = "where to output release notes (stdout by default)",
metavar = "file"
)
-
- filter_group = parser.add_argument_group("Filters")
- filter_group.add_argument(
+ parser.add_argument(
"-v", "--version",
action = "append",
type = str,
- help = "Ignore all changes not belonging to a version (can be specified multiple times)",
+ help = "ignore all changes not belonging to a version (can be specified multiple times)",
metavar = "name"
)
- filter_group.add_argument(
+ parser.add_argument(
"-f", "--from-date",
type = parse_date,
default = parse_date("2000-01-01"),
- help = "Ignore all changes before date",
+ help = "ignore all changes before date",
metavar = "yyyy-mm-dd"
)
- filter_group.add_argument(
+ parser.add_argument(
"-t", "--to-date",
type = parse_date,
default = gmtime(),
- help = "Ignore all changes after date",
+ help = "ignore all changes after date",
metavar = "yyyy-mm-dd"
)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9463b83..ea4f4d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@
contributing to PSn00bSDK, add a new block at the top following this template:
```
-## <year>-<month>-<day>: <new version>
+## <year>-<month>-<day>: [optional new version]
<contributor>:
@@ -19,6 +19,17 @@ to ensure the changelog can be parsed correctly.
-------------------------------------------------------------------------------
+## 2021-12-23
+
+spicyjpeg:
+
+- psxcd: `CdGetSector()` now expects the sector size to be in 32-bit word units
+ (rather than bytes) for consistency with the official CD-ROM library. The
+ library's ISO9660 parser and helper functions have been updated accordingly.
+ **This is a breaking change**.
+
+- examples: Added `spustream` audio streaming example.
+
## 2021-11-28: 0.18
spicyjpeg:
@@ -453,7 +464,7 @@ Lameguy64:
- psxgpu: Fixed typos in `setUVWH()` macro.
-- Added `_boot()` BIOS function (A(A0h) aka Warmboot, useful for CD based
+- Added `_boot()` BIOS function (`A(A0h)` aka Warmboot, useful for CD based
serial loaders).
## 2019-08-17: 0.13b
@@ -505,9 +516,9 @@ Lameguy64:
executable to return to a parent executable, return logic automatically
calls `EnterCriticalSection()`.
-- libc: Updated build method which takes libgcc from the compiler and adds
+- libc: Updated build method which takes `libgcc` from the compiler and adds
its own object files into it, eliminating linker problems caused by having
- to order libc and libgcc libraries in a specific manner.
+ to order `libc` and `libgcc` libraries in a specific manner.
- psxgpu: Added `RestartCallback()`.
@@ -526,7 +537,7 @@ Lameguy64:
performance, as the R3000 does not support 64-bit arithmetic natively
so its emulated like floats. `int64` still used for processing floats and
doubles and old `vsprintf.c` file is still included for those who really
- want int64 support for whatever reason.
+ want `int64` support for whatever reason.
- libc: Removed `stdarg.h` which is part of GCC and not license compatible
with MPL. The toolchain compiled with libgcc provides `stdarg.h` and other
@@ -540,7 +551,7 @@ Lameguy64:
- psxgpu: Fixed bug in DMACallback where the internal DMA handler would fail
to install due to `GetInterruptCallback()` retrieving the callback value
- immediately in the branch delay slot of a jr instruction, which resuls to
+ immediately in the branch delay slot of a `jr` instruction, which resuls to
an inconsistent return value. This also broke `DrawSyncCallback()`.
- psxsio: Done fixes on `_sio_control()` from the aformentioned issues with
@@ -619,7 +630,7 @@ Lameguy64:
ready instead of simply waiting for GPU transfer ready which is the likely
cause of subtle GPU related timing issues, it also sets GPU DMA transfer
mode to off afterwards. It can also read number of words remaining in DMA
- transfer if a0 is non-zero but it likely only returns the correct value on
+ transfer if `a0` is non-zero but it likely only returns the correct value on
VRAM transfers. Exact way how `DrawSync()` returns the count in the official
SDK is currently unknown.
@@ -645,10 +656,10 @@ Lameguy64:
- Added `rgb24` example.
- Got custom exit handler set using `SetCustomExitFromException()` (BIOS
- function B(19h)) working. Currently used to acknowledge VSync IRQ but
+ function `B(19h)`) working. Currently used to acknowledge VSync IRQ but
actual VSync handling is still done with events and needs to be
transferred to the custom exit handler. At least it lets BIOS
- controller functions to work now. See doc/dev `notes.txt` for details
+ controller functions to work now. See `doc/dev notes.txt` for details
on how this handler behaves.
- Made stack usage in `ResetGraph()` less wasteful. You only need to
diff --git a/examples/cdrom/cdxa/main.c b/examples/cdrom/cdxa/main.c
index 5f11d8d..284b92f 100644
--- a/examples/cdrom/cdxa/main.c
+++ b/examples/cdrom/cdxa/main.c
@@ -199,7 +199,7 @@ void xa_callback(int intr, unsigned char *result)
if (intr == CdlDataReady)
{
/* Fetch data sector */
- CdGetSector((u_long*)&xa_sector_buff, 2048);
+ CdGetSector((u_long*)&xa_sector_buff, 512);
/* Quirk: This CdGetSector() implementation must fetch 2048 bytes */
/* or more otherwise the following sectors will be read in an */
diff --git a/examples/io/system573/main.c b/examples/io/system573/main.c
index 67a98da..95c3155 100644
--- a/examples/io/system573/main.c
+++ b/examples/io/system573/main.c
@@ -306,7 +306,7 @@ int main(int argc, const char* argv[]) {
FntPrint(-1, " P1 BUTTONS =%07@\n", inputs.p1_btn);
FntPrint(-1, " P2 JOYSTICK =%04@\n", inputs.p2_joy);
FntPrint(-1, " P2 BUTTONS =%07@\n", inputs.p2_btn);
- FntPrint(-1, " COIN/SERVICE=%04@\n", inputs.coin);
+ FntPrint(-1, " COIN/SERVICE=%04@\n", inputs.coin & 0xf);
FntPrint(-1, " DIP SWITCHES=%04@\n", inputs.dip_sw);
FntPrint(-1, "\nCABINET LIGHTS:\n");
diff --git a/libpsn00b/psxcd/cdgetsector.s b/libpsn00b/psxcd/cdgetsector.s
index 9af3543..dbe95cb 100644
--- a/libpsn00b/psxcd/cdgetsector.s
+++ b/libpsn00b/psxcd/cdgetsector.s
@@ -18,7 +18,8 @@ CdGetSector:
# nop
lui $v0, 0x1
- srl $a1, 2
+# srl $a1, 2 # (the official implementation expects $a1/size
+ # to be in 32-bit words rather than bytes)
or $v0, $a1
sw $a0, D3_MADR($a2) # Set DMA base address and transfer length
sw $v0, D3_BCR($a2)
diff --git a/libpsn00b/psxcd/isofs.c b/libpsn00b/psxcd/isofs.c
index 29bbb76..d1c1b18 100644
--- a/libpsn00b/psxcd/isofs.c
+++ b/libpsn00b/psxcd/isofs.c
@@ -795,7 +795,7 @@ static void _scan_callback(int status, unsigned char *result)
{
if( status == CdlDataReady )
{
- CdGetSector((void*)_ses_scanbuff, 2048);
+ CdGetSector((void*)_ses_scanbuff, 512);
if( _ses_scanbuff[0] == 0x1 )
{
diff --git a/libpsn00b/psxcd/psxcd.c b/libpsn00b/psxcd/psxcd.c
index 74c6c1c..76415f9 100644
--- a/libpsn00b/psxcd/psxcd.c
+++ b/libpsn00b/psxcd/psxcd.c
@@ -255,7 +255,7 @@ static void _CdReadReadyCallback(int status, unsigned char *result)
CdGetSector((void*)_cd_read_addr, _cd_read_sector_sz);
// Increment destination address
- _cd_read_addr += _cd_read_sector_sz>>2;
+ _cd_read_addr += _cd_read_sector_sz;
// Subtract sector count
_cd_sector_count--;
@@ -290,15 +290,15 @@ int CdRead(int sectors, u_long *buf, int mode)
// Determine sector based on mode flags
if( mode & CdlModeSize0 )
{
- _cd_read_sector_sz = 2328;
+ _cd_read_sector_sz = 2328 / 4;
}
else if( mode & CdlModeSize1 )
{
- _cd_read_sector_sz = 2340;
+ _cd_read_sector_sz = 2340 / 4;
}
else
{
- _cd_read_sector_sz = 2048;
+ _cd_read_sector_sz = 2048 / 4;
}
_cd_read_counter = VSync(-1);