implement multiple cover photos

This commit is contained in:
Zack Buhman 2025-07-04 15:04:44 -05:00
parent 4f185a32c6
commit 1f8cb233e4
41 changed files with 438 additions and 176 deletions

BIN
cover/clocks.data Normal file

Binary file not shown.

15
cover/clocks.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_clocks_data_start __asm("_binary_cover_clocks_data_start");
extern uint32_t _binary_cover_clocks_data_end __asm("_binary_cover_clocks_data_end");
extern uint32_t _binary_cover_clocks_data_size __asm("_binary_cover_clocks_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/clocks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_cover1_data_start __asm("_binary_cover_cover1_data_start");
extern uint32_t _binary_cover_cover1_data_end __asm("_binary_cover_cover1_data_end");
extern uint32_t _binary_cover_cover1_data_size __asm("_binary_cover_cover1_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

1
cover/mossycottage.data Normal file

File diff suppressed because one or more lines are too long

15
cover/mossycottage.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_mossycottage_data_start __asm("_binary_cover_mossycottage_data_start");
extern uint32_t _binary_cover_mossycottage_data_end __asm("_binary_cover_mossycottage_data_end");
extern uint32_t _binary_cover_mossycottage_data_size __asm("_binary_cover_mossycottage_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/mossycottage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
cover/mountain.data Normal file

Binary file not shown.

15
cover/mountain.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_mountain_data_start __asm("_binary_cover_mountain_data_start");
extern uint32_t _binary_cover_mountain_data_end __asm("_binary_cover_mountain_data_end");
extern uint32_t _binary_cover_mountain_data_size __asm("_binary_cover_mountain_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/mountain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

1
cover/mountainfull.data Normal file

File diff suppressed because one or more lines are too long

15
cover/mountainfull.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_mountainfull_data_start __asm("_binary_cover_mountainfull_data_start");
extern uint32_t _binary_cover_mountainfull_data_end __asm("_binary_cover_mountainfull_data_end");
extern uint32_t _binary_cover_mountainfull_data_size __asm("_binary_cover_mountainfull_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/mountainfull.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
cover/redtree Normal file

Binary file not shown.

BIN
cover/redtree.data Normal file

Binary file not shown.

15
cover/redtree.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_redtree_data_start __asm("_binary_cover_redtree_data_start");
extern uint32_t _binary_cover_redtree_data_end __asm("_binary_cover_redtree_data_end");
extern uint32_t _binary_cover_redtree_data_size __asm("_binary_cover_redtree_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/redtree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
cover/redtreefull.data Normal file

Binary file not shown.

15
cover/redtreefull.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_redtreefull_data_start __asm("_binary_cover_redtreefull_data_start");
extern uint32_t _binary_cover_redtreefull_data_end __asm("_binary_cover_redtreefull_data_end");
extern uint32_t _binary_cover_redtreefull_data_size __asm("_binary_cover_redtreefull_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/redtreefull.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

BIN
cover/silvertrees.data Normal file

Binary file not shown.

15
cover/silvertrees.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_silvertrees_data_start __asm("_binary_cover_silvertrees_data_start");
extern uint32_t _binary_cover_silvertrees_data_end __asm("_binary_cover_silvertrees_data_end");
extern uint32_t _binary_cover_silvertrees_data_size __asm("_binary_cover_silvertrees_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/silvertrees.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
cover/silvertreesfull.data Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_silvertreesfull_data_start __asm("_binary_cover_silvertreesfull_data_start");
extern uint32_t _binary_cover_silvertreesfull_data_end __asm("_binary_cover_silvertreesfull_data_end");
extern uint32_t _binary_cover_silvertreesfull_data_size __asm("_binary_cover_silvertreesfull_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/silvertreesfull.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

116
cover/thebeach.data Normal file

File diff suppressed because one or more lines are too long

15
cover/thebeach.data.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_cover_thebeach_data_start __asm("_binary_cover_thebeach_data_start");
extern uint32_t _binary_cover_thebeach_data_end __asm("_binary_cover_thebeach_data_end");
extern uint32_t _binary_cover_thebeach_data_size __asm("_binary_cover_thebeach_data_size");
#ifdef __cplusplus
}
#endif

BIN
cover/thebeach.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -7,6 +7,8 @@
#include "sound.hpp" #include "sound.hpp"
#include "playlist.hpp" #include "playlist.hpp"
#include "scene/tracker/cover.hpp"
namespace interpreter { namespace interpreter {
struct interpreter_state state = {}; struct interpreter_state state = {};
@ -349,7 +351,7 @@ void stop_sound()
{ {
for (int ch = 0; ch < 64; ch++) { for (int ch = 0; ch < 64; ch++) {
wait(); wait();
bool kyonb = aica_sound.channel[ch].KYONB() != 0; //bool kyonb = aica_sound.channel[ch].KYONB() != 0;
wait(); aica_sound.channel[ch].KYONB(0); wait(); aica_sound.channel[ch].KYONB(0);
//state.channel[ch].keyon = kyonb ? 255 : 0; //state.channel[ch].keyon = kyonb ? 255 : 0;
} }
@ -377,9 +379,10 @@ void unpause()
static uint8_t __attribute__((aligned(32))) sample_data[1024 * 1024 * 2]; static uint8_t __attribute__((aligned(32))) sample_data[1024 * 1024 * 2];
const int sample_data_length = (sizeof (sample_data)); const int sample_data_length = (sizeof (sample_data));
void deferred_load(int buf) void deferred_load(int buf, int cover_ix)
{ {
const float aica_clock_multiplier = 44.1 / 3; const float aica_clock_multiplier = 44.1 / 3;
state.deferred_cover_ix = cover_ix;
state.deferred_load_tick = aica_clock_multiplier * 1000 / 2; state.deferred_load_tick = aica_clock_multiplier * 1000 / 2;
@ -394,6 +397,8 @@ void deferred_load_finish()
{ {
sound::transfer(sample_data, state.sample_data_ix); sound::transfer(sample_data, state.sample_data_ix);
scene::tracker::cover::cover_ix = state.deferred_cover_ix;
resume_sound(); resume_sound();
} }

View File

@ -28,6 +28,7 @@ struct interpreter_state {
int deferred_load_tick; int deferred_load_tick;
int sample_data_ix; int sample_data_ix;
int deferred_cover_ix;
struct xm_state xm; struct xm_state xm;
@ -43,6 +44,6 @@ void unpause();
void resume_sound(); void resume_sound();
void stop_sound(); void stop_sound();
void deferred_load(int buf); void deferred_load(int buf, int cover_ix);
void deferred_load_finish(); void deferred_load_finish();
} }

View File

@ -7,6 +7,8 @@
#include "xm/CottageFantasy2.xm.h" #include "xm/CottageFantasy2.xm.h"
#include "xm/CloudsAhead6.xm.h" #include "xm/CloudsAhead6.xm.h"
#include "scene/tracker/cover.hpp"
namespace playlist { namespace playlist {
struct state state = { struct state state = {
@ -15,19 +17,16 @@ namespace playlist {
const playlist_item playlist[] = { const playlist_item playlist[] = {
{ {
"Shiroiii", .artist = "Shiroiii",
"CottageFantasy2", .title = "CottageFantasy2",
(int)&_binary_xm_CottageFantasy2_xm_start, .start = (int)&_binary_xm_CottageFantasy2_xm_start,
.cover_ix = scene::tracker::cover::mossycottage,
}, },
{ {
"Shiroiii", .artist = "Shiroiii",
"CloudsAhead6", .title = "CloudsAhead6",
(int)&_binary_xm_CloudsAhead6_xm_start, .start = (int)&_binary_xm_CloudsAhead6_xm_start,
}, .cover_ix = scene::tracker::cover::mountain,
{
"leon du star",
"milkypack01",
(int)&_binary_xm_milkypack01_xm_start,
}, },
}; };
@ -41,7 +40,9 @@ namespace playlist {
printf("next deferred_load playlist_ix %d\n", state.playlist_ix); printf("next deferred_load playlist_ix %d\n", state.playlist_ix);
interpreter::stop_sound(); interpreter::stop_sound();
interpreter::deferred_load(playlist[state.playlist_ix].start);
const playlist_item& item = playlist[state.playlist_ix];
interpreter::deferred_load(item.start, item.cover_ix);
} }
void prev(bool stop_sound) void prev(bool stop_sound)
@ -52,6 +53,7 @@ namespace playlist {
printf("prev deferred_load playlist_ix %d\n", state.playlist_ix); printf("prev deferred_load playlist_ix %d\n", state.playlist_ix);
interpreter::stop_sound(); interpreter::stop_sound();
interpreter::deferred_load(playlist[state.playlist_ix].start); const playlist_item& item = playlist[state.playlist_ix];
interpreter::deferred_load(item.start, item.cover_ix);
} }
} }

View File

@ -5,6 +5,7 @@ namespace playlist {
const char * const artist; const char * const artist;
const char * const title; const char * const title;
const int start; const int start;
const int cover_ix;
}; };
struct state { struct state {

View File

@ -6,24 +6,96 @@
namespace scene::tracker::cover { namespace scene::tracker::cover {
constexpr float texture_width = 1.0 / 128.0; struct cover {
constexpr float texture_height = 1.0 / 128.0; uint32_t texture_offset;
uint32_t texture_size;
float texture_width;
float texture_height;
float width;
float height;
};
constexpr inline vec3 transform_position(const vec2& p, int cover_ix = -1;
static const cover covers[] = {
[thebeach] = {
.texture_offset = texture::offset::thebeach,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
[silvertrees] = {
.texture_offset = texture::offset::silvertrees,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
[redtree] = {
.texture_offset = texture::offset::redtree,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
[mountain] = {
.texture_offset = texture::offset::mountain,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
[mossycottage] = {
.texture_offset = texture::offset::mossycottage,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
[clocks] = {
.texture_offset = texture::offset::clocks,
.texture_size = tsp_instruction_word::texture_u_size::from_int(128)
| tsp_instruction_word::texture_v_size::from_int(128),
.texture_width = 1.0f / 128.0f,
.texture_height = 1.0f / 128.0f,
.width = 72,
.height = 72,
},
};
constexpr inline vec3 transform_position(const cover& cover,
const vec2& p,
float x, float y, float z) float x, float y, float z)
{ {
float x_offset = (128.0f - cover.width) * 0.5f;
float y_offset = (128.0f - cover.width) * 0.5f;
if (x_offset < 0) x_offset = 0;
if (y_offset < 0) y_offset = 0;
return { return {
x + p.x * 128, x + x_offset + p.x * cover.width,
y + p.y * 128, y + y_offset + p.y * cover.height,
z z
}; };
} }
constexpr inline vec2 transform_texture(const vec2& t) constexpr inline vec2 transform_texture(const cover& cover,
const vec2& t)
{ {
return { return {
(0 + t.x * 72) * texture_width, (t.x * cover.width) * cover.texture_width,
(0 + t.y * 72) * texture_height, (t.y * cover.height) * cover.texture_height,
}; };
} }
@ -36,13 +108,17 @@ namespace scene::tracker::cover {
void draw(ta_multiwriter& multi, float x, float y) void draw(ta_multiwriter& multi, float x, float y)
{ {
uint32_t texture_size = tsp_instruction_word::texture_u_size::from_int(128) if (cover_ix < 0)
| tsp_instruction_word::texture_v_size::from_int(128) return;
const cover& cover = covers[cover_ix];
uint32_t texture_size = cover.texture_size
| tsp_instruction_word::dst_alpha_instr::zero; | tsp_instruction_word::dst_alpha_instr::zero;
global_polygon_textured(multi.op, global_polygon_textured(multi.op,
para_control::list_type::translucent, para_control::list_type::translucent,
texture::offset::cover1, cover.texture_offset,
texture_size, texture_size,
texture_control_word::pixel_format::_565); texture_control_word::pixel_format::_565);
@ -50,15 +126,15 @@ namespace scene::tracker::cover {
int base_color = 0xffffff; int base_color = 0xffffff;
vec3 ap = transform_position(vtx[0], x, y, z); vec3 ap = transform_position(cover, vtx[0], x, y, z);
vec3 bp = transform_position(vtx[1], x, y, z); vec3 bp = transform_position(cover, vtx[1], x, y, z);
vec3 cp = transform_position(vtx[2], x, y, z); vec3 cp = transform_position(cover, vtx[2], x, y, z);
vec3 dp = transform_position(vtx[3], x, y, z); vec3 dp = transform_position(cover, vtx[3], x, y, z);
vec2 at = transform_texture(vtx[0]); vec2 at = transform_texture(cover, vtx[0]);
vec2 bt = transform_texture(vtx[1]); vec2 bt = transform_texture(cover, vtx[1]);
vec2 ct = transform_texture(vtx[2]); vec2 ct = transform_texture(cover, vtx[2]);
vec2 dt = transform_texture(vtx[3]); vec2 dt = transform_texture(cover, vtx[3]);
quad_type_3(multi.op, quad_type_3(multi.op,
ap, at, ap, at,

View File

@ -3,5 +3,16 @@
#include "ta_multiwriter.hpp" #include "ta_multiwriter.hpp"
namespace scene::tracker::cover { namespace scene::tracker::cover {
extern int cover_ix;
enum cover_type {
thebeach,
silvertrees,
redtree,
mountain,
mossycottage,
clocks,
};
void draw(ta_multiwriter& multi, float x, float y); void draw(ta_multiwriter& multi, float x, float y);
} }

View File

@ -271,7 +271,7 @@ namespace scene::tracker {
tracklist::draw(multi, top.width + 5, 5); tracklist::draw(multi, top.width + 5, 5);
float y = top.y() + top.height + 5; float y = top.y() + top.height + 5;
channel_status::draw(multi, 5, y); channel_status::draw(multi, 5, y);
cover::draw(multi, 480, 8); cover::draw(multi, 480, 5);
y += channel_status::height + 10; y += channel_status::height + 10;
notes::draw(multi, 5, y); notes::draw(multi, 5, y);

View File

@ -12,10 +12,18 @@
#include "font/tandy1k.data.h" #include "font/tandy1k.data.h"
#include "model/32bitlogo/colors.data.h" #include "model/32bitlogo/colors.data.h"
#include "font/icons.data.h" #include "font/icons.data.h"
#include "cover/cover1.data.h"
#include "font/ter-u24n.data.h" #include "font/ter-u24n.data.h"
#include "font/ter-u32n.data.h" #include "font/ter-u32n.data.h"
#include "cover/clocks.data.h"
#include "cover/mossycottage.data.h"
#include "cover/mountain.data.h"
#include "cover/redtree.data.h"
#include "cover/silvertrees.data.h"
#include "cover/thebeach.data.h"
#include "printf/printf.h"
namespace texture { namespace texture {
struct texture textures[] = { struct texture textures[] = {
@ -45,10 +53,35 @@ namespace texture {
.offset = offset::ter_u32n, .offset = offset::ter_u32n,
}, },
{ {
.start = reinterpret_cast<void *>(&_binary_cover_cover1_data_start), .start = reinterpret_cast<void *>(&_binary_cover_clocks_data_start),
.size = reinterpret_cast<int>(&_binary_cover_cover1_data_size), .size = reinterpret_cast<int>(&_binary_cover_clocks_data_size),
.offset = offset::cover1, .offset = offset::clocks,
} },
{
.start = reinterpret_cast<void *>(&_binary_cover_mossycottage_data_start),
.size = reinterpret_cast<int>(&_binary_cover_mossycottage_data_size),
.offset = offset::mossycottage,
},
{
.start = reinterpret_cast<void *>(&_binary_cover_mountain_data_start),
.size = reinterpret_cast<int>(&_binary_cover_mountain_data_size),
.offset = offset::mountain,
},
{
.start = reinterpret_cast<void *>(&_binary_cover_redtree_data_start),
.size = reinterpret_cast<int>(&_binary_cover_redtree_data_size),
.offset = offset::redtree,
},
{
.start = reinterpret_cast<void *>(&_binary_cover_silvertrees_data_start),
.size = reinterpret_cast<int>(&_binary_cover_silvertrees_data_size),
.offset = offset::silvertrees,
},
{
.start = reinterpret_cast<void *>(&_binary_cover_thebeach_data_start),
.size = reinterpret_cast<int>(&_binary_cover_thebeach_data_size),
.offset = offset::thebeach,
},
}; };
const int textures_length = (sizeof (textures)) / (sizeof (textures[0])); const int textures_length = (sizeof (textures)) / (sizeof (textures[0]));
@ -89,6 +122,7 @@ namespace texture {
for (int i = 0; i < textures_length; i++) { for (int i = 0; i < textures_length; i++) {
uint32_t offset = texture_memory_alloc.texture.start + textures[i].offset; uint32_t offset = texture_memory_alloc.texture.start + textures[i].offset;
printf("texture offset %d\n", textures[i].offset);
void * dst = reinterpret_cast<void *>(&ta_fifo_texture_memory[offset / 4]); void * dst = reinterpret_cast<void *>(&ta_fifo_texture_memory[offset / 4]);
void * src = textures[i].start; void * src = textures[i].start;
int size = textures[i].size; int size = textures[i].size;

View File

@ -13,7 +13,12 @@ namespace texture {
constexpr int icons = logo + 384; // 2048 constexpr int icons = logo + 384; // 2048
constexpr int ter_u24n = icons + 2048; // 16384 constexpr int ter_u24n = icons + 2048; // 16384
constexpr int ter_u32n = ter_u24n + 16384; // 32768 constexpr int ter_u32n = ter_u24n + 16384; // 32768
constexpr int cover1 = ter_u32n + 32768; // 32768 constexpr int clocks = ter_u32n + 32768;
constexpr int mossycottage = clocks + 32768;
constexpr int mountain = mossycottage + 32768;
constexpr int redtree = mountain + 32768;
constexpr int silvertrees = redtree + 32768;
constexpr int thebeach = silvertrees + 32768;
}; };
extern struct texture textures[]; extern struct texture textures[];

View File

@ -7,10 +7,15 @@ TEXTURE_OBJ = \
font/tandy1k.data.o \ font/tandy1k.data.o \
font/icons.data.o \ font/icons.data.o \
model/32bitlogo/colors.data.o \ model/32bitlogo/colors.data.o \
cover/cover1.data.o \
reference_render.data.o \ reference_render.data.o \
font/ter-u24n.data.o \ font/ter-u24n.data.o \
font/ter-u32n.data.o font/ter-u32n.data.o \
cover/clocks.data.o \
cover/mossycottage.data.o \
cover/mountain.data.o \
cover/redtree.data.o \
cover/silvertrees.data.o \
cover/thebeach.data.o
PCM_OBJ = \ PCM_OBJ = \
pcm/start3.adpcm.o \ pcm/start3.adpcm.o \