diff --git a/misc/ps1/iso.xml b/misc/ps1/iso.xml index f2b72e3af..e0dc72082 100644 --- a/misc/ps1/iso.xml +++ b/misc/ps1/iso.xml @@ -61,65 +61,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/ps1/sounds/audio.zip b/misc/ps1/sounds/audio.zip new file mode 100644 index 000000000..7d61bd8cd Binary files /dev/null and b/misc/ps1/sounds/audio.zip differ diff --git a/misc/ps1/sounds/dig_cloth1.snd b/misc/ps1/sounds/dig_cloth1.snd new file mode 100644 index 000000000..8d0702d0e Binary files /dev/null and b/misc/ps1/sounds/dig_cloth1.snd differ diff --git a/misc/ps1/sounds/dig_cloth2.snd b/misc/ps1/sounds/dig_cloth2.snd new file mode 100644 index 000000000..058f4542e Binary files /dev/null and b/misc/ps1/sounds/dig_cloth2.snd differ diff --git a/misc/ps1/sounds/dig_cloth3.snd b/misc/ps1/sounds/dig_cloth3.snd new file mode 100644 index 000000000..45d70c6c9 Binary files /dev/null and b/misc/ps1/sounds/dig_cloth3.snd differ diff --git a/misc/ps1/sounds/dig_cloth4.snd b/misc/ps1/sounds/dig_cloth4.snd new file mode 100644 index 000000000..3e03a4eda Binary files /dev/null and b/misc/ps1/sounds/dig_cloth4.snd differ diff --git a/misc/ps1/sounds/dig_glass1.snd b/misc/ps1/sounds/dig_glass1.snd new file mode 100644 index 000000000..73bf7f61c Binary files /dev/null and b/misc/ps1/sounds/dig_glass1.snd differ diff --git a/misc/ps1/sounds/dig_glass2.snd b/misc/ps1/sounds/dig_glass2.snd new file mode 100644 index 000000000..47212aed4 Binary files /dev/null and b/misc/ps1/sounds/dig_glass2.snd differ diff --git a/misc/ps1/sounds/dig_glass3.snd b/misc/ps1/sounds/dig_glass3.snd new file mode 100644 index 000000000..ccb86b252 Binary files /dev/null and b/misc/ps1/sounds/dig_glass3.snd differ diff --git a/misc/ps1/sounds/dig_grass1.snd b/misc/ps1/sounds/dig_grass1.snd new file mode 100644 index 000000000..c809be165 Binary files /dev/null and b/misc/ps1/sounds/dig_grass1.snd differ diff --git a/misc/ps1/sounds/dig_grass2.snd b/misc/ps1/sounds/dig_grass2.snd new file mode 100644 index 000000000..4c5eb5033 Binary files /dev/null and b/misc/ps1/sounds/dig_grass2.snd differ diff --git a/misc/ps1/sounds/dig_grass3.snd b/misc/ps1/sounds/dig_grass3.snd new file mode 100644 index 000000000..1cc41f0b1 Binary files /dev/null and b/misc/ps1/sounds/dig_grass3.snd differ diff --git a/misc/ps1/sounds/dig_grass4.snd b/misc/ps1/sounds/dig_grass4.snd new file mode 100644 index 000000000..50ed0171c Binary files /dev/null and b/misc/ps1/sounds/dig_grass4.snd differ diff --git a/misc/ps1/sounds/dig_gravel1.snd b/misc/ps1/sounds/dig_gravel1.snd new file mode 100644 index 000000000..f8ec26bdd Binary files /dev/null and b/misc/ps1/sounds/dig_gravel1.snd differ diff --git a/misc/ps1/sounds/dig_gravel2.snd b/misc/ps1/sounds/dig_gravel2.snd new file mode 100644 index 000000000..fad03c82f Binary files /dev/null and b/misc/ps1/sounds/dig_gravel2.snd differ diff --git a/misc/ps1/sounds/dig_gravel3.snd b/misc/ps1/sounds/dig_gravel3.snd new file mode 100644 index 000000000..aff847dfe Binary files /dev/null and b/misc/ps1/sounds/dig_gravel3.snd differ diff --git a/misc/ps1/sounds/dig_gravel4.snd b/misc/ps1/sounds/dig_gravel4.snd new file mode 100644 index 000000000..2a50dece8 Binary files /dev/null and b/misc/ps1/sounds/dig_gravel4.snd differ diff --git a/misc/ps1/sounds/dig_sand1.snd b/misc/ps1/sounds/dig_sand1.snd new file mode 100644 index 000000000..9fbebde68 Binary files /dev/null and b/misc/ps1/sounds/dig_sand1.snd differ diff --git a/misc/ps1/sounds/dig_sand2.snd b/misc/ps1/sounds/dig_sand2.snd new file mode 100644 index 000000000..9f2797214 Binary files /dev/null and b/misc/ps1/sounds/dig_sand2.snd differ diff --git a/misc/ps1/sounds/dig_sand3.snd b/misc/ps1/sounds/dig_sand3.snd new file mode 100644 index 000000000..95d47f2e5 Binary files /dev/null and b/misc/ps1/sounds/dig_sand3.snd differ diff --git a/misc/ps1/sounds/dig_sand4.snd b/misc/ps1/sounds/dig_sand4.snd new file mode 100644 index 000000000..2b09b1e6d Binary files /dev/null and b/misc/ps1/sounds/dig_sand4.snd differ diff --git a/misc/ps1/sounds/dig_snow1.snd b/misc/ps1/sounds/dig_snow1.snd new file mode 100644 index 000000000..394df0c1c Binary files /dev/null and b/misc/ps1/sounds/dig_snow1.snd differ diff --git a/misc/ps1/sounds/dig_snow2.snd b/misc/ps1/sounds/dig_snow2.snd new file mode 100644 index 000000000..8a1fd4dc2 Binary files /dev/null and b/misc/ps1/sounds/dig_snow2.snd differ diff --git a/misc/ps1/sounds/dig_snow3.snd b/misc/ps1/sounds/dig_snow3.snd new file mode 100644 index 000000000..28fd8b1e6 Binary files /dev/null and b/misc/ps1/sounds/dig_snow3.snd differ diff --git a/misc/ps1/sounds/dig_snow4.snd b/misc/ps1/sounds/dig_snow4.snd new file mode 100644 index 000000000..c1c79a1b0 Binary files /dev/null and b/misc/ps1/sounds/dig_snow4.snd differ diff --git a/misc/ps1/sounds/dig_stone1.snd b/misc/ps1/sounds/dig_stone1.snd new file mode 100644 index 000000000..ab5dee260 Binary files /dev/null and b/misc/ps1/sounds/dig_stone1.snd differ diff --git a/misc/ps1/sounds/dig_stone2.snd b/misc/ps1/sounds/dig_stone2.snd new file mode 100644 index 000000000..8de042722 Binary files /dev/null and b/misc/ps1/sounds/dig_stone2.snd differ diff --git a/misc/ps1/sounds/dig_stone3.snd b/misc/ps1/sounds/dig_stone3.snd new file mode 100644 index 000000000..5634fe42b Binary files /dev/null and b/misc/ps1/sounds/dig_stone3.snd differ diff --git a/misc/ps1/sounds/dig_stone4.snd b/misc/ps1/sounds/dig_stone4.snd new file mode 100644 index 000000000..4de67cab2 Binary files /dev/null and b/misc/ps1/sounds/dig_stone4.snd differ diff --git a/misc/ps1/sounds/dig_wood1.snd b/misc/ps1/sounds/dig_wood1.snd new file mode 100644 index 000000000..b0fc552e7 Binary files /dev/null and b/misc/ps1/sounds/dig_wood1.snd differ diff --git a/misc/ps1/sounds/dig_wood2.snd b/misc/ps1/sounds/dig_wood2.snd new file mode 100644 index 000000000..ea87da80e Binary files /dev/null and b/misc/ps1/sounds/dig_wood2.snd differ diff --git a/misc/ps1/sounds/dig_wood3.snd b/misc/ps1/sounds/dig_wood3.snd new file mode 100644 index 000000000..be23cffd7 Binary files /dev/null and b/misc/ps1/sounds/dig_wood3.snd differ diff --git a/misc/ps1/sounds/dig_wood4.snd b/misc/ps1/sounds/dig_wood4.snd new file mode 100644 index 000000000..d3c66b328 Binary files /dev/null and b/misc/ps1/sounds/dig_wood4.snd differ diff --git a/misc/ps1/sounds/gen.sh b/misc/ps1/sounds/gen.sh new file mode 100755 index 000000000..a1162314e --- /dev/null +++ b/misc/ps1/sounds/gen.sh @@ -0,0 +1,9 @@ +rm "audio.zip" *.wav +wget "classicube.net/static/audio.zip" +unzip "audio.zip" + +for i in *.wav; do + ~/repos/psxavenc/build/psxavenc -t spu -f 32000 $i "${i%.wav}.snd" +done + +rm *.wav diff --git a/misc/ps1/sounds/step_cloth1.snd b/misc/ps1/sounds/step_cloth1.snd new file mode 100644 index 000000000..8d0702d0e Binary files /dev/null and b/misc/ps1/sounds/step_cloth1.snd differ diff --git a/misc/ps1/sounds/step_cloth2.snd b/misc/ps1/sounds/step_cloth2.snd new file mode 100644 index 000000000..058f4542e Binary files /dev/null and b/misc/ps1/sounds/step_cloth2.snd differ diff --git a/misc/ps1/sounds/step_cloth3.snd b/misc/ps1/sounds/step_cloth3.snd new file mode 100644 index 000000000..45d70c6c9 Binary files /dev/null and b/misc/ps1/sounds/step_cloth3.snd differ diff --git a/misc/ps1/sounds/step_cloth4.snd b/misc/ps1/sounds/step_cloth4.snd new file mode 100644 index 000000000..3e03a4eda Binary files /dev/null and b/misc/ps1/sounds/step_cloth4.snd differ diff --git a/misc/ps1/sounds/step_grass1.snd b/misc/ps1/sounds/step_grass1.snd new file mode 100644 index 000000000..c809be165 Binary files /dev/null and b/misc/ps1/sounds/step_grass1.snd differ diff --git a/misc/ps1/sounds/step_grass2.snd b/misc/ps1/sounds/step_grass2.snd new file mode 100644 index 000000000..4c5eb5033 Binary files /dev/null and b/misc/ps1/sounds/step_grass2.snd differ diff --git a/misc/ps1/sounds/step_grass3.snd b/misc/ps1/sounds/step_grass3.snd new file mode 100644 index 000000000..1cc41f0b1 Binary files /dev/null and b/misc/ps1/sounds/step_grass3.snd differ diff --git a/misc/ps1/sounds/step_grass4.snd b/misc/ps1/sounds/step_grass4.snd new file mode 100644 index 000000000..50ed0171c Binary files /dev/null and b/misc/ps1/sounds/step_grass4.snd differ diff --git a/misc/ps1/sounds/step_gravel1.snd b/misc/ps1/sounds/step_gravel1.snd new file mode 100644 index 000000000..f8ec26bdd Binary files /dev/null and b/misc/ps1/sounds/step_gravel1.snd differ diff --git a/misc/ps1/sounds/step_gravel2.snd b/misc/ps1/sounds/step_gravel2.snd new file mode 100644 index 000000000..fad03c82f Binary files /dev/null and b/misc/ps1/sounds/step_gravel2.snd differ diff --git a/misc/ps1/sounds/step_gravel3.snd b/misc/ps1/sounds/step_gravel3.snd new file mode 100644 index 000000000..aff847dfe Binary files /dev/null and b/misc/ps1/sounds/step_gravel3.snd differ diff --git a/misc/ps1/sounds/step_gravel4.snd b/misc/ps1/sounds/step_gravel4.snd new file mode 100644 index 000000000..2a50dece8 Binary files /dev/null and b/misc/ps1/sounds/step_gravel4.snd differ diff --git a/misc/ps1/sounds/step_sand1.snd b/misc/ps1/sounds/step_sand1.snd new file mode 100644 index 000000000..9fbebde68 Binary files /dev/null and b/misc/ps1/sounds/step_sand1.snd differ diff --git a/misc/ps1/sounds/step_sand2.snd b/misc/ps1/sounds/step_sand2.snd new file mode 100644 index 000000000..9f2797214 Binary files /dev/null and b/misc/ps1/sounds/step_sand2.snd differ diff --git a/misc/ps1/sounds/step_sand3.snd b/misc/ps1/sounds/step_sand3.snd new file mode 100644 index 000000000..95d47f2e5 Binary files /dev/null and b/misc/ps1/sounds/step_sand3.snd differ diff --git a/misc/ps1/sounds/step_sand4.snd b/misc/ps1/sounds/step_sand4.snd new file mode 100644 index 000000000..2b09b1e6d Binary files /dev/null and b/misc/ps1/sounds/step_sand4.snd differ diff --git a/misc/ps1/sounds/step_snow1.snd b/misc/ps1/sounds/step_snow1.snd new file mode 100644 index 000000000..394df0c1c Binary files /dev/null and b/misc/ps1/sounds/step_snow1.snd differ diff --git a/misc/ps1/sounds/step_snow2.snd b/misc/ps1/sounds/step_snow2.snd new file mode 100644 index 000000000..8a1fd4dc2 Binary files /dev/null and b/misc/ps1/sounds/step_snow2.snd differ diff --git a/misc/ps1/sounds/step_snow3.snd b/misc/ps1/sounds/step_snow3.snd new file mode 100644 index 000000000..28fd8b1e6 Binary files /dev/null and b/misc/ps1/sounds/step_snow3.snd differ diff --git a/misc/ps1/sounds/step_snow4.snd b/misc/ps1/sounds/step_snow4.snd new file mode 100644 index 000000000..c1c79a1b0 Binary files /dev/null and b/misc/ps1/sounds/step_snow4.snd differ diff --git a/misc/ps1/sounds/step_stone1.snd b/misc/ps1/sounds/step_stone1.snd new file mode 100644 index 000000000..ab5dee260 Binary files /dev/null and b/misc/ps1/sounds/step_stone1.snd differ diff --git a/misc/ps1/sounds/step_stone2.snd b/misc/ps1/sounds/step_stone2.snd new file mode 100644 index 000000000..8de042722 Binary files /dev/null and b/misc/ps1/sounds/step_stone2.snd differ diff --git a/misc/ps1/sounds/step_stone3.snd b/misc/ps1/sounds/step_stone3.snd new file mode 100644 index 000000000..5634fe42b Binary files /dev/null and b/misc/ps1/sounds/step_stone3.snd differ diff --git a/misc/ps1/sounds/step_stone4.snd b/misc/ps1/sounds/step_stone4.snd new file mode 100644 index 000000000..4de67cab2 Binary files /dev/null and b/misc/ps1/sounds/step_stone4.snd differ diff --git a/misc/ps1/sounds/step_wood1.snd b/misc/ps1/sounds/step_wood1.snd new file mode 100644 index 000000000..b0fc552e7 Binary files /dev/null and b/misc/ps1/sounds/step_wood1.snd differ diff --git a/misc/ps1/sounds/step_wood2.snd b/misc/ps1/sounds/step_wood2.snd new file mode 100644 index 000000000..ea87da80e Binary files /dev/null and b/misc/ps1/sounds/step_wood2.snd differ diff --git a/misc/ps1/sounds/step_wood3.snd b/misc/ps1/sounds/step_wood3.snd new file mode 100644 index 000000000..be23cffd7 Binary files /dev/null and b/misc/ps1/sounds/step_wood3.snd differ diff --git a/misc/ps1/sounds/step_wood4.snd b/misc/ps1/sounds/step_wood4.snd new file mode 100644 index 000000000..d3c66b328 Binary files /dev/null and b/misc/ps1/sounds/step_wood4.snd differ diff --git a/src/Graphics_Dreamcast.c b/src/Graphics_Dreamcast.c index 8bcc8aaa4..bd8b59642 100644 --- a/src/Graphics_Dreamcast.c +++ b/src/Graphics_Dreamcast.c @@ -465,13 +465,14 @@ static CC_INLINE int FindInPalette(BitmapCol* palette, int pal_count, BitmapCol } static int CalcPalette(BitmapCol* palette, struct Bitmap* bmp, int rowWidth) { - int pal_count = 0; + int width = bmp->width, height = bmp->height; + + BitmapCol* row = bmp->scan0; + int pal_count = 0; - for (int y = 0; y < bmp->height; y++) + for (int y = 0; y < height; y++, row += rowWidth) { - BitmapCol* row = bmp->scan0 + y * rowWidth; - - for (int x = 0; x < bmp->width; x++) + for (int x = 0; x < width; x++) { BitmapCol color = row[x]; int idx = FindInPalette(palette, pal_count, color); diff --git a/src/Graphics_NDS.c b/src/Graphics_NDS.c index 5ad11c441..ace687162 100644 --- a/src/Graphics_NDS.c +++ b/src/Graphics_NDS.c @@ -319,14 +319,15 @@ static CC_INLINE int FindInPalette(cc_uint16* pal, int pal_size, cc_uint16 color } static CC_INLINE int CalcPalette(cc_uint16* palette, struct Bitmap* bmp, int rowWidth) { + int width = bmp->width, height = bmp->height; + cc_uint16* row = bmp->scan0; + int pal_count = 1; palette[0] = 0; // entry 0 is transparent colour - for (int y = 0; y < bmp->height; y++) + for (int y = 0; y < height; y++, row += rowWidth) { - cc_uint16* row = bmp->scan0 + y * rowWidth; - - for (int x = 0; x < bmp->width; x++) + for (int x = 0; x < width; x++) { cc_uint16 color = row[x]; int idx = FindInPalette(palette, pal_count, color); @@ -378,40 +379,34 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, char* tmp = (char*)tmp_u16; u32 banks = vramSetPrimaryBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD); - int stride; - if (tex_fmt == GL_RGB4) { - char* buf = malloc(tex_size); - int i = 0; - if (!buf) return NULL; + int width = bmp->width, height = bmp->height; + cc_uint16* row = bmp->scan0; - for (int y = 0; y < bmp->height; y++) + if (tex_fmt == GL_RGB4) { + stride = width >> 3; + + for (int y = 0; y < height; y++, row += rowWidth) { - cc_uint16* row = bmp->scan0 + y * rowWidth; - - for (int x = 0; x < bmp->width; x++, i++) + for (int x = 0; x < width; x++) { int idx = FindInPalette(palette, pal_count, row[x]); - if ((i & 3) == 0) { - buf[i >> 2] = idx; + if ((x & 3) == 0) { + tmp[x >> 2] = idx; } else { - buf[i >> 2] |= idx << (2 * (i & 3)); + tmp[x >> 2] |= idx << (2 * (x & 3)); } } + CopyHWords(tmp, addr + stride * y, stride); } - - CopyHWords(buf, addr, tex_size >> 1); - free(buf); } else if (tex_fmt == GL_RGB16) { - stride = bmp->width >> 2; + stride = width >> 2; - for (int y = 0; y < bmp->height; y++, addr += stride) + for (int y = 0; y < height; y++, addr += stride, row += rowWidth) { - cc_uint16* row = bmp->scan0 + y * rowWidth; - - for (int x = 0; x < bmp->width; x++) + for (int x = 0; x < width; x++) { int idx = FindInPalette(palette, pal_count, row[x]); @@ -424,24 +419,22 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, CopyHWords(tmp, addr, stride); } } else if (tex_fmt == GL_RGB256) { - stride = bmp->width >> 1; + stride = width >> 1; - for (int y = 0; y < bmp->height; y++, addr += stride) + for (int y = 0; y < height; y++, addr += stride, row += rowWidth) { - cc_uint16* row = bmp->scan0 + y * rowWidth; - - for (int x = 0; x < bmp->width; x++) + for (int x = 0; x < width; x++) { tmp[x] = FindInPalette(palette, pal_count, row[x]); } CopyHWords(tmp, addr, stride); } } else { - stride = bmp->width; + stride = width; - for (int y = 0; y < bmp->height; y++, addr += stride) { - cc_uint16* src = bmp->scan0 + y * rowWidth; - CopyHWords(src, addr, stride); + for (int y = 0; y < height; y++, addr += stride, row += rowWidth) + { + CopyHWords(row, addr, stride); } } diff --git a/src/Graphics_PS2.c b/src/Graphics_PS2.c index 764023b2c..7e53af7c5 100644 --- a/src/Graphics_PS2.c +++ b/src/Graphics_PS2.c @@ -168,7 +168,8 @@ static CC_INLINE void DMAFlushBuffer(void) { *#########################################################################################################################*/ typedef struct CCTexture_ { cc_uint32 width, height; - cc_uint32 log2_width, log2_height; + cc_uint16 log2_width, log2_height; + cc_uint16 format, pal_index; cc_uint32 pad[(64 - 16)/4]; BitmapCol pixels[]; // aligned to 64 bytes (only need 16?) } CCTexture; @@ -181,6 +182,8 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, tex->height = bmp->height; tex->log2_width = draw_log2(bmp->width); tex->log2_height = draw_log2(bmp->height); + tex->format = GS_PSM_32; + tex->pal_index = 0; CopyTextureData(tex->pixels, bmp->width * BITMAPCOLOR_SIZE, bmp, rowWidth * BITMAPCOLOR_SIZE); @@ -191,7 +194,7 @@ static void UpdateTextureBuffer(int context, CCTexture* tex, unsigned buf_addr, PACK_GIFTAG(q, GIF_SET_TAG(1,0,0,0, GIF_FLG_PACKED, 1), GIF_REG_AD); q++; - PACK_GIFTAG(q, GS_SET_TEX0(buf_addr >> 6, buf_stride >> 6, GS_PSM_32, + PACK_GIFTAG(q, GS_SET_TEX0(buf_addr >> 6, buf_stride >> 6, tex->format, tex->log2_width, tex->log2_height, TEXTURE_COMPONENTS_RGBA, TEXTURE_FUNCTION_MODULATE, 0, 0, CLUT_STORAGE_MODE1, 0, CLUT_NO_LOAD), GS_REG_TEX0 + context); q++; @@ -214,10 +217,10 @@ void Gfx_BindTexture(GfxResourceID texId) { qword_t *Q = packet->data; - Q = draw_texture_transfer(Q, tex->pixels, tex->width, tex->height, GS_PSM_32, dst_addr, dst_stride); + Q = draw_texture_transfer(Q, tex->pixels, tex->width, tex->height, tex->buffer, dst_addr, dst_stride); Q = draw_texture_flush(Q); - dma_channel_send_chain(DMA_CHANNEL_GIF,packet->data, Q - packet->data, 0,0); + dma_channel_send_chain(DMA_CHANNEL_GIF, packet->data, Q - packet->data, 0,0); dma_wait_fast(); packet_free(packet);