hopefully work
This commit is contained in:
parent
a85cc3bd22
commit
72240cb601
73
.github/workflows/build.yml
vendored
Normal file
73
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: devkitpro/devkitarm
|
||||
name: "Build with devkitARM"
|
||||
outputs:
|
||||
commit_tag: ${{ steps.build.outputs.commit_tag }}
|
||||
commit_message: ${{ steps.build.outputs.commit_message }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup NodejS
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install dependency
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install ffmpeg build-essential curl
|
||||
|
||||
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
|
||||
sudo chmod a+rx /usr/local/bin/youtube-dl
|
||||
|
||||
- name: Prepare video
|
||||
run: |
|
||||
cd assets
|
||||
youtube-dl -f 18 https://www.youtube.com/watch?v=FtutLA63Cp8 -o 'video.%(ext)s'
|
||||
|
||||
sh convert.sh
|
||||
|
||||
- name: Encode video
|
||||
run: |
|
||||
cd encoder
|
||||
npm install
|
||||
|
||||
cd cpp
|
||||
g++ lzss.cpp -o lzss
|
||||
cd ..
|
||||
|
||||
node .
|
||||
|
||||
- name: Build NDS
|
||||
run: |
|
||||
cp assets/music.raw NDS/nitrofiles/
|
||||
cp encoder/data_compress NDS/nitrofiles/
|
||||
|
||||
cd NDS
|
||||
make
|
||||
|
||||
- name: Prepare artefact
|
||||
run: |
|
||||
cd NDS/dist
|
||||
mkdir -p dist
|
||||
tar -czvf dist/${{ github.event.repository.name }}.tar.gz *.nds
|
||||
|
||||
- name: Upload to basement
|
||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
||||
with:
|
||||
server: ${{ secrets.ftp_server }}
|
||||
username: ${{ secrets.ftp_username }}
|
||||
password: ${{ secrets.ftp_password }}
|
||||
local-dir: ./NDS/dist/dist/
|
||||
server-dir: ./public_html/basement/${{ github.event.repository.name }}/
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -5,8 +5,13 @@
|
||||
!/NDS/nitrofiles/.gitignore
|
||||
/NDS/cmake
|
||||
/NDS/compile_commands.json
|
||||
/NDS/.cache
|
||||
/NDS/build
|
||||
/NDS/dist
|
||||
|
||||
/encoder/node_modules
|
||||
/encoder/data_compress
|
||||
/encoder/temp
|
||||
/encoder/cpp/lzss
|
||||
|
||||
/temp
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <maxmod9.h>
|
||||
#include <vector>
|
||||
|
||||
#define TIMER_SPEED (BUS_CLOCK/1024)
|
||||
|
||||
@ -14,9 +13,23 @@ uint16_t blockSize;
|
||||
char buffer[256*192*2];
|
||||
char buffer2[256*256*2];
|
||||
|
||||
bool shouldDraw = false;
|
||||
bool queueAvaible = false;
|
||||
|
||||
void VBlankProc() {
|
||||
in.read((char*)&blockSize, sizeof(blockSize));
|
||||
in.read(buffer, blockSize);
|
||||
if (shouldDraw) {
|
||||
shouldDraw = false;
|
||||
|
||||
if (queueAvaible) {
|
||||
queueAvaible = false;
|
||||
|
||||
dmaCopyWordsAsynch(3, buffer2, VRAM_A, 256*192*2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimerTick() {
|
||||
shouldDraw = true;
|
||||
}
|
||||
|
||||
mm_word on_stream_request( mm_word length, mm_addr dest, mm_stream_formats format ) {
|
||||
@ -42,7 +55,7 @@ mm_word on_stream_request( mm_word length, mm_addr dest, mm_stream_formats forma
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
consoleDebugInit(DebugDevice_NOCASH);
|
||||
consoleDemoInit();
|
||||
|
||||
videoSetMode(MODE_FB0);
|
||||
vramSetBankA(VRAM_A_LCD);
|
||||
@ -51,60 +64,48 @@ int main(void) {
|
||||
|
||||
|
||||
// nitrofiles initialization
|
||||
if (nitroFSInit(NULL)) {
|
||||
if (!nitroFSInit(NULL)) {
|
||||
chdir("nitro:/");
|
||||
std::cerr << "nitrofs init success" << std::endl;
|
||||
} else {
|
||||
consoleDemoInit();
|
||||
std::cout << "cannot init nitrofs" << std::endl;
|
||||
std::cout << "failed to init nitrofs" << std::endl;
|
||||
std::cout << "Please launch the game\nfrom nds-bootstrap from twilightmenu" << std::endl;
|
||||
while(1) {
|
||||
// freezee
|
||||
}
|
||||
}
|
||||
|
||||
in.open("output", std::ios::binary);
|
||||
|
||||
uint16_t totalsize;
|
||||
char buf[256*192*2];
|
||||
char buf2[256*256*2];
|
||||
|
||||
in.read((char*)&totalsize, sizeof(totalsize));
|
||||
in.read(buf, totalsize);
|
||||
|
||||
swiDecompressLZSSWram(buf, buf2);
|
||||
dmaCopyWordsAsynch(3, buf2, VRAM_A, 256*192*2);
|
||||
|
||||
// for (int i=0; i<192*256; i++) {
|
||||
// VRAM_A[i] = buf[i];
|
||||
// }
|
||||
|
||||
while(1) {
|
||||
// loop
|
||||
}
|
||||
|
||||
mmInitDefault((char*)"soundbank.bin");
|
||||
file = fopen("music.raw","rb");
|
||||
|
||||
mm_stream mystream;
|
||||
mystream.sampling_rate = 22050; // sampling rate = 25khz
|
||||
mystream.buffer_length = 1200; // buffer length = 1200 samples
|
||||
mystream.buffer_length = 2400; // buffer length = 1200 samples
|
||||
mystream.callback = on_stream_request; // set callback function
|
||||
mystream.format = MM_STREAM_16BIT_MONO; // format = stereo 16-bit
|
||||
mystream.timer = MM_TIMER0; // use hardware timer 0
|
||||
mystream.manual = false; // use manual filling
|
||||
mystream.manual = true; // use manual filling
|
||||
mmStreamOpen( &mystream );
|
||||
|
||||
irqSet(IRQ_VBLANK, VBlankProc);
|
||||
// quick hack... sometime it need to update once?
|
||||
mmStreamUpdate(); mmStreamUpdate();
|
||||
|
||||
while(1) {
|
||||
// loop
|
||||
}
|
||||
irqSet(IRQ_VBLANK, VBlankProc);
|
||||
timerStart(2, ClockDivider_1024, TIMER_FREQ_1024(30), TimerTick);
|
||||
|
||||
in.open("data_compress", std::ios::in | std::ios::binary);
|
||||
|
||||
while(1) {
|
||||
swiDecompressLZSSWram(buffer, buffer2);
|
||||
dmaCopyWordsAsynch(3, buffer2, VRAM_A, 256*192*2);
|
||||
while(true) {
|
||||
// timerElapsed(2);
|
||||
mmStreamUpdate();
|
||||
|
||||
if (!in.eof() && !queueAvaible) {
|
||||
in.read((char*)&blockSize, sizeof(blockSize));
|
||||
in.read(buffer, blockSize);
|
||||
swiDecompressLZSSWram(buffer, buffer2);
|
||||
queueAvaible = true;
|
||||
}
|
||||
|
||||
swiWaitForVBlank();
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ ffmpeg -i $video -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse=dither=no
|
||||
# ffmpeg -i $video -vf "$filters" out/out_%d.bmp
|
||||
|
||||
# audio
|
||||
ffmpeg -i $video -f s16le -ac 1 -ar 48000 music.raw
|
||||
ffmpeg -i $video -f s16le -ac 1 -ar 22050 music.raw
|
@ -5,7 +5,7 @@ const { execSync } = require('child_process');
|
||||
execSync("rm -rf data_compress")
|
||||
|
||||
// load gif
|
||||
const gif_raw = fs.readFileSync("../assets/out-60.gif");
|
||||
const gif_raw = fs.readFileSync("../assets/out.gif");
|
||||
const gif_data = new omg.GifReader(gif_raw);
|
||||
const num_pixel = gif_data.width * gif_data.height;
|
||||
const num_frames = gif_data.numFrames();
|
||||
@ -66,8 +66,6 @@ for (let i=0; i<num_frames; i++) {
|
||||
console.log(`Convert frames ${i+1} of ${num_frames}`);
|
||||
}
|
||||
|
||||
execSync("cp data_compress ../nitrofiles/")
|
||||
|
||||
// console.log(buffer_final)
|
||||
// console.log(pallete)
|
||||
console.log("Num pallete:", pallete.length)
|
||||
|
Loading…
x
Reference in New Issue
Block a user