Skip to content

Commit

Permalink
Merge pull request #8 from BJNFNE/bashscript-uppercase-fix
Browse files Browse the repository at this point in the history
MediaStation Code improvements
  • Loading branch information
npjg authored Jul 30, 2024
2 parents 74964fa + feb06d0 commit f998315
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/MediaStation/Assets/BitmapRle.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static PyObject *method_decompress_media_station_rle(PyObject *self, PyObject *a
// does not allow NULL values and does not handle embedded null bytes. It returns
// a new reference to the bytes-like object.
if(!PyArg_ParseTuple(args, "y#II", &compressed_image_data, &compressed_image_data_size, &width, &height)) {
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c: Failed to parse arguments.");
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c::PyArg_ParseTuple(): Failed to parse arguments.");
return NULL;
}

Expand All @@ -33,7 +33,7 @@ static PyObject *method_decompress_media_station_rle(PyObject *self, PyObject *a
if (uncompressed_image_data_object == NULL) {
// TODO: We really should use Py_DECREF here I think, but since the
// program will currently just quit it isn't a big deal.
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c: Failed to allocate uncompressed image data buffer.");
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c::PyBytes_FromStringAndSize(): Failed to allocate uncompressed image data buffer.");
return NULL;
}
char *uncompressed_image_data = PyBytes_AS_STRING(uncompressed_image_data_object);
Expand All @@ -47,7 +47,7 @@ static PyObject *method_decompress_media_station_rle(PyObject *self, PyObject *a
PyObject *transparency_regions_list;
transparency_regions_list = PyList_New(0);
if (transparency_regions_list == NULL) {
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c: Failed to allocate transparency regions list.");
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c::PyList_New(): Failed to allocate transparency regions list.");
return NULL;
}

Expand All @@ -59,7 +59,7 @@ static PyObject *method_decompress_media_station_rle(PyObject *self, PyObject *a
Py_DECREF(uncompressed_image_data_object);
Py_DECREF(transparency_regions_list);
if (return_value == NULL) {
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c: Failed to build return value.");
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c::Py_BuildValue(): Failed to build return value.");
return NULL;
}
return return_value;
Expand Down Expand Up @@ -197,7 +197,7 @@ static PyObject *method_decompress_media_station_rle(PyObject *self, PyObject *a
Py_DECREF(uncompressed_image_data_object);
Py_DECREF(transparency_regions_list);
if (return_value == NULL) {
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c: Failed to build return value.");
PyErr_Format(PyExc_RuntimeError, "BitmapRle.c::Py_BuildValue(): Failed to build return value.");
return NULL;
}
return return_value;
Expand Down
8 changes: 4 additions & 4 deletions src/MediaStation/Assets/ImaAdpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Most of the code in this file is borrowed from SoX,
// specifically sox/src/adpcms.c, which is licensed
// under the GPL.
// under the GPLv3.

static int const ima_steps[89] = {
7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
Expand Down Expand Up @@ -66,7 +66,7 @@ static PyObject* decode(PyObject* self, PyObject* args) {
const char *input;
Py_ssize_t input_length;
if (!PyArg_ParseTuple(args, "y#", &input, &input_length)) {
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c: Failed to parse arguments.");
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c::PyArg_ParseTuble(): Failed to parse arguments.");
return NULL;
}

Expand All @@ -75,14 +75,14 @@ static PyObject* decode(PyObject* self, PyObject* args) {
// each ADPCM sample (4 bits) expands to one 16-bit PCM sample.
PyObject *output = PyBytes_FromStringAndSize(NULL, input_length * 4);
if (output == NULL) {
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c: Failed to allocate decoded audio object.");
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c::PyBytes_FromStringAndSize(): Failed to allocate decoded audio object.");
return NULL;
}
int16_t *output_buffer = (int16_t *)PyBytes_AS_STRING(output);
if (output_buffer == NULL) {
// Failure here is uncommon after a successful allocation.
Py_DECREF(output);
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c: Failed to access aecoded audio buffer.");
PyErr_Format(PyExc_RuntimeError, "ImaAdpcm.c::PyBytes_AS_STRING(): Failed to access aecoded audio buffer.");
return NULL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ cwd="$(pwd)"
partitions_on_attached_iso=$(hdiutil attach -nomount "$iso_path")
echo $partitions_on_attached_iso

# MOUNT THE WINDOWS (CD9660) PORTION.
# MOUNT THE WINDOWS (CD9660) PARTITION.
disk_identifier=$(echo "$partitions_on_attached_iso" | awk '{print $1}' | head -n 1)
echo "CD9660 Portion: $mount_point"
echo "CD9660 Partition: $mount_point"
mount -t cd9660 "$disk_identifier" "$mount_point"

# PRINT THE HASHES OF EACH FILE IN THE WINDODWS PORTION.
# PRINT THE HASHES OF EACH FILE IN THE WINDODWS PARTITION.
# This gets the hashes of all files in the root directory.
for file in "$mount_point"/*; do
md5sum "$file" 2> /dev/null
Expand Down

0 comments on commit f998315

Please sign in to comment.