restore macaw example
This commit is contained in:
parent
b133879f7e
commit
3bf80b521a
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@ scramble
|
|||||||
cdi4dc
|
cdi4dc
|
||||||
tools/ttf_outline
|
tools/ttf_outline
|
||||||
tools/ttf_bitmap
|
tools/ttf_bitmap
|
||||||
|
tools/ftdi_transfer
|
||||||
k_means_vq
|
k_means_vq
|
||||||
*.blend1
|
*.blend1
|
||||||
*.scramble
|
*.scramble
|
||||||
|
@ -34,7 +34,7 @@ SECTIONS
|
|||||||
KEEP(*(.ctors.*))
|
KEEP(*(.ctors.*))
|
||||||
} > p1ram
|
} > p1ram
|
||||||
|
|
||||||
.bss ALIGN(4) (NOLOAD) : SUBALIGN(4)
|
.bss ALIGN(4) (NOLOAD) :
|
||||||
{
|
{
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss.*)
|
*(.bss.*)
|
||||||
|
16
common.mk
16
common.mk
@ -2,7 +2,7 @@ MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|||||||
DIR := $(dir $(MAKEFILE_PATH))
|
DIR := $(dir $(MAKEFILE_PATH))
|
||||||
|
|
||||||
LIB ?= .
|
LIB ?= .
|
||||||
OPT ?= -O2
|
OPT ?= -Og
|
||||||
GENERATED ?=
|
GENERATED ?=
|
||||||
|
|
||||||
AARCH = --isa=sh4 --little
|
AARCH = --isa=sh4 --little
|
||||||
@ -80,13 +80,13 @@ sine.pcm: common.mk
|
|||||||
/=./COPYRIGH.TXT \
|
/=./COPYRIGH.TXT \
|
||||||
/=./ABSTRACT.TXT \
|
/=./ABSTRACT.TXT \
|
||||||
/=./BIBLIOGR.TXT \
|
/=./BIBLIOGR.TXT \
|
||||||
/=./REIGN.PCM \
|
/=./pcm/REIGN.PCM \
|
||||||
/=./PILLAR.PCM \
|
/=./pcm/PILLAR.PCM \
|
||||||
/=./RIDDLE.PCM \
|
/=./pcm/RIDDLE.PCM \
|
||||||
/=./PRELUDE.PCM \
|
/=./pcm/PRELUDE.PCM \
|
||||||
/=./CLOCKTOW.PCM \
|
/=./pcm/CLOCKTOW.PCM \
|
||||||
/=./ELEC.PCM \
|
/=./pcm/ELEC.PCM \
|
||||||
/=./ECCLESIA.PCM
|
/=./pcm/ECCLESIA.PCM
|
||||||
|
|
||||||
%.cdi: %.iso
|
%.cdi: %.iso
|
||||||
./cdi4dc $< $@ >/dev/null
|
./cdi4dc $< $@ >/dev/null
|
||||||
|
@ -206,14 +206,17 @@ void * memset(void * dest, int c, size_t n)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fft::complex comp[samples_per_line * 2];
|
static fft::complex comp[samples_per_line * 8];
|
||||||
|
|
||||||
void render_column(int col, int x, const uint32_t * buf)
|
int render_column(int col, int x, const uint32_t * buf)
|
||||||
{
|
{
|
||||||
uint32_t offset = texture_memory_alloc::texture.start + 0;
|
uint32_t offset = texture_memory_alloc::texture.start + 0;
|
||||||
auto texture = reinterpret_cast<volatile uint32_t *>(&texture_memory64[offset / 4]);
|
auto texture = reinterpret_cast<volatile uint32_t *>(&texture_memory64[offset / 4]);
|
||||||
|
|
||||||
const int16_t * src = &((int16_t *)(buf))[col * samples_per_line * 2];
|
const int16_t * src = &((int16_t *)(buf))[col * samples_per_line / 2];
|
||||||
|
if ((src) >= (int16_t*)&buf[(chunk_size - samples_per_line * 2)/4])
|
||||||
|
return 0; // FIXME: this is a hack
|
||||||
|
|
||||||
fft::int16_to_complex(src, samples_per_line * 2, comp);
|
fft::int16_to_complex(src, samples_per_line * 2, comp);
|
||||||
fft::fft(comp, samples_per_line * 2);
|
fft::fft(comp, samples_per_line * 2);
|
||||||
for (int32_t y = 0; y < samples_per_line; y++) {
|
for (int32_t y = 0; y < samples_per_line; y++) {
|
||||||
@ -229,24 +232,27 @@ void render_column(int col, int x, const uint32_t * buf)
|
|||||||
value |= v << shift;
|
value |= v << shift;
|
||||||
texture[ix / 4] = value;
|
texture[ix / 4] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
void texture_init();
|
void texture_init();
|
||||||
|
|
||||||
void aica_step(uint32_t& chunk_index, const uint32_t gdrom_buf[2][chunk_size / 4])
|
void aica_step(uint32_t& chunk_index, const uint32_t gdrom_buf[2][chunk_size / 4 * 2])
|
||||||
{
|
{
|
||||||
{ // wait for interrupt from arm
|
{ // wait for interrupt from arm
|
||||||
int col = 0;
|
int col = 0;
|
||||||
while ((system.ISTEXT & (1 << 1)) == 0) {
|
while ((system.ISTEXT & (1 << 1)) == 0) {
|
||||||
if (step_time >= 0) {
|
if (step_time >= 0) {
|
||||||
int32_t dt = step_start - (int32_t)sh7091.TMU.TCNT0;
|
int32_t dt = step_start - (int32_t)sh7091.TMU.TCNT0;
|
||||||
if (step_time * col / lines_per_chunk < dt) {
|
if (step_time * col / (lines_per_chunk * 4) < dt) {
|
||||||
render_column(col, __x, gdrom_buf[!chunk_index]);
|
int inc = render_column(col, __x, gdrom_buf[!chunk_index]);
|
||||||
render();
|
col += inc;
|
||||||
col += 1;
|
__x += inc;
|
||||||
__x += 1;
|
|
||||||
__x %= samples_per_line;
|
__x %= samples_per_line;
|
||||||
|
if (col % 2)
|
||||||
|
render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -362,14 +368,9 @@ uint32_t gdrom_cd_read2(uint16_t * buf,
|
|||||||
length += byte_count;
|
length += byte_count;
|
||||||
gdrom_read_data(buf, byte_count);
|
gdrom_read_data(buf, byte_count);
|
||||||
|
|
||||||
serial::string("status: ");
|
|
||||||
serial::integer<uint8_t>(gdrom_if.status);
|
|
||||||
|
|
||||||
while ((gdrom::status::bsy(gdrom_if.status)) != 0); // wait for drive to become not-busy
|
while ((gdrom::status::bsy(gdrom_if.status)) != 0); // wait for drive to become not-busy
|
||||||
}
|
}
|
||||||
|
|
||||||
serial::string("length: ");
|
|
||||||
serial::integer<uint32_t>(length);
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +467,7 @@ struct extent gdrom_find_file()
|
|||||||
serial::string(dr->file_identifier, dr->length_of_file_identifier);
|
serial::string(dr->file_identifier, dr->length_of_file_identifier);
|
||||||
serial::character('\n');
|
serial::character('\n');
|
||||||
|
|
||||||
const char filename[] = "ELEC.PCM;1";
|
const char filename[] = "RIDDLE.PCM;1";
|
||||||
bool equal = str_equal(dr->file_identifier, dr->length_of_file_identifier,
|
bool equal = str_equal(dr->file_identifier, dr->length_of_file_identifier,
|
||||||
filename, (sizeof (filename)) - 1);
|
filename, (sizeof (filename)) - 1);
|
||||||
|
|
||||||
@ -603,7 +604,9 @@ void render()
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
serial::init(4);
|
memset(&comp, 0, (sizeof (comp)));
|
||||||
|
|
||||||
|
serial::init(0);
|
||||||
|
|
||||||
holly.SOFTRESET = softreset::pipeline_soft_reset
|
holly.SOFTRESET = softreset::pipeline_soft_reset
|
||||||
| softreset::ta_soft_reset;
|
| softreset::ta_soft_reset;
|
||||||
@ -646,7 +649,7 @@ void main()
|
|||||||
|
|
||||||
gdrom_unlock();
|
gdrom_unlock();
|
||||||
const auto extent = gdrom_find_file();
|
const auto extent = gdrom_find_file();
|
||||||
uint32_t gdrom_buf[2][chunk_size / 4];
|
uint32_t gdrom_buf[2][(chunk_size / 4) * 2] = {0};
|
||||||
gdrom_read_chunk(gdrom_buf[chunk_index], extent.location + segment_index, sectors_per_chunk);
|
gdrom_read_chunk(gdrom_buf[chunk_index], extent.location + segment_index, sectors_per_chunk);
|
||||||
next_segment(extent, segment_index);
|
next_segment(extent, segment_index);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "holly/video_output.hpp"
|
#include "holly/video_output.hpp"
|
||||||
#include "memorymap.hpp"
|
#include "memorymap.hpp"
|
||||||
|
|
||||||
#include "macaw.hpp"
|
#include "texture/macaw/macaw.data.h"
|
||||||
|
|
||||||
struct vertex {
|
struct vertex {
|
||||||
float x;
|
float x;
|
||||||
@ -110,13 +110,13 @@ void init_texture_memory(const struct opb_size& opb_size)
|
|||||||
480 / 32, // height
|
480 / 32, // height
|
||||||
opb_size
|
opb_size
|
||||||
);
|
);
|
||||||
background_parameter(0xff00ff00);
|
background_parameter(0xff004400);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_macaw_texture()
|
void copy_macaw_texture()
|
||||||
{
|
{
|
||||||
auto src = reinterpret_cast<const uint8_t *>(&_binary_macaw_data_start);
|
auto src = reinterpret_cast<const uint8_t *>(&_binary_texture_macaw_macaw_data_start);
|
||||||
auto size = reinterpret_cast<const uint32_t>(&_binary_macaw_data_size);
|
auto size = reinterpret_cast<const uint32_t>(&_binary_texture_macaw_macaw_data_size);
|
||||||
auto texture = reinterpret_cast<volatile uint16_t *>(&texture_memory64[texture_memory_alloc::texture.start / 4]);
|
auto texture = reinterpret_cast<volatile uint16_t *>(&texture_memory64[texture_memory_alloc::texture.start / 4]);
|
||||||
for (uint32_t px = 0; px < size / 3; px++) {
|
for (uint32_t px = 0; px < size / 3; px++) {
|
||||||
uint8_t r = src[px * 3 + 0];
|
uint8_t r = src[px * 3 + 0];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <functional>
|
#include <tuple>
|
||||||
|
|
||||||
#include "vec.hpp"
|
#include "vec.hpp"
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include "vec2.hpp"
|
||||||
|
|
||||||
template <int R, int C, typename T>
|
template <int R, int C, typename T>
|
||||||
struct mat;
|
struct mat;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include "vec4.hpp"
|
||||||
|
|
||||||
template <int R, int C, typename T>
|
template <int R, int C, typename T>
|
||||||
struct mat;
|
struct mat;
|
||||||
|
5
texture/macaw/macaw.data.h
Normal file
5
texture/macaw/macaw.data.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
extern uint32_t _binary_texture_macaw_macaw_data_start __asm("_binary_texture_macaw_macaw_data_start");
|
||||||
|
extern uint32_t _binary_texture_macaw_macaw_data_end __asm("_binary_texture_macaw_macaw_data_end");
|
||||||
|
extern uint32_t _binary_texture_macaw_macaw_data_size __asm("_binary_texture_macaw_macaw_data_size");
|
@ -1,5 +0,0 @@
|
|||||||
#include <cstdint>
|
|
||||||
|
|
||||||
extern uint32_t _binary_macaw_data_start __asm("_binary_macaw_data_start");
|
|
||||||
extern uint32_t _binary_macaw_data_end __asm("_binary_macaw_data_end");
|
|
||||||
extern uint32_t _binary_macaw_data_size __asm("_binary_macaw_data_size");
|
|
Loading…
x
Reference in New Issue
Block a user