diff options
author | Bad Diode <bd@badd10de.dev> | 2021-05-28 21:29:04 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-05-28 21:29:04 +0200 |
commit | 9c61e2e75220439e917fa5fba9d59014a2a5c43a (patch) | |
tree | b9b4a4a535163238bd50707c05139a560cc92f71 | |
parent | 1fabc50056826ba54ad2a613e5509f3047414cae (diff) | |
download | uxngba-9c61e2e75220439e917fa5fba9d59014a2a5c43a.tar.gz uxngba-9c61e2e75220439e917fa5fba9d59014a2a5c43a.zip |
Update README
-rw-r--r-- | README.md | 67 | ||||
-rw-r--r-- | src/apu.c | 3 | ||||
-rw-r--r-- | src/main.c | 29 |
3 files changed, 57 insertions, 42 deletions
@@ -9,22 +9,20 @@ screen or console devices, including the beautiful DVD bouncing. | |||
9 | ## Building from source | 9 | ## Building from source |
10 | 10 | ||
11 | To build this software you need the [devkitPro][devkitpro] SDK. Once installed, | 11 | To build this software you need the [devkitPro][devkitpro] SDK. Once installed, |
12 | You may need to modify the Makefile to set up the path: | 12 | you may need to modify the Makefile to ensure the path is correct, but should |
13 | work with the default devikit installation methods on Linux and macOS. | ||
13 | 14 | ||
14 | ``` | 15 | ``` |
15 | DEVKITPRO := /opt/devkitpro | 16 | DEVKITPRO := /opt/devkitpro |
16 | DEVKITARM := /opt/devkitpro/devkitARM | 17 | DEVKITBIN := $(DEVKITPRO)/devkitARM/bin |
17 | PATH := $(DEVKITARM)/bin:$(PATH) | 18 | DEVKITTOOLS := $(DEVKITPRO)/tools/bin |
18 | LIBGBA_DIR := $(DEVKITPRO)/libgba | 19 | LIBGBA_DIR := $(DEVKITPRO)/libgba |
19 | LIBGBA_SRC := /opt/devkitpro/libgba/include/ | 20 | LIBGBA_SRC := $(DEVKITPRO)/libgba/include/ |
20 | LIBGBA := $(LIBGBA_DIR)/lib/libgba.a | 21 | LIBGBA := $(LIBGBA_DIR)/lib/libgba.a |
21 | LIBGBA += $(LIBGBA_DIR)/lib/libfat.a | 22 | LIBGBA += $(LIBGBA_DIR)/lib/libfat.a |
22 | LIBGBA += $(LIBGBA_DIR)/lib/libmm.a | 23 | LIBGBA += $(LIBGBA_DIR)/lib/libmm.a |
23 | ``` | 24 | ``` |
24 | 25 | ||
25 | An intermediate build step will create a `src/uxn/roms/boot.c` file, for which | ||
26 | you need the `bin2carr` utility that can be found [here][bin2carr]. | ||
27 | |||
28 | If everything is properly installed, you should be able to run `make` to compile | 26 | If everything is properly installed, you should be able to run `make` to compile |
29 | the program into a `uxngba.gba` rom. If you have `mgba-qt` installed, you can | 27 | the program into a `uxngba.gba` rom. If you have `mgba-qt` installed, you can |
30 | test it with: `make run`. | 28 | test it with: `make run`. |
@@ -33,8 +31,49 @@ To use a specific UXN compiled rom, you can pass it as the `ROM_SRC` make | |||
33 | parameter: | 31 | parameter: |
34 | 32 | ||
35 | ``` | 33 | ``` |
36 | make run ROM_SRC=src/uxn/roms/piano.rom | 34 | make run ROM_SRC=roms/noodle.rom |
37 | ``` | 35 | ``` |
38 | 36 | ||
37 | If you have compiled a rom already and want to change it, you probably want to | ||
38 | use `make clean` beforehand. | ||
39 | |||
39 | [devkitpro]: https://devkitpro.org/ | 40 | [devkitpro]: https://devkitpro.org/ |
40 | [bin2carr]: https://git.badd10de.dev/gba-dev-tools/ | 41 | |
42 | ## Configuration | ||
43 | |||
44 | The output .gba files will embed the rom used for installation. Different roms | ||
45 | have different needs, such as the usage of different input methods or the | ||
46 | desired audio quality. These options can be selected by defining the right | ||
47 | macros on compile time as described below. | ||
48 | |||
49 | ### Input method order | ||
50 | |||
51 | Uxngba currently supports three different control schemes that can be cycled by | ||
52 | pressing the SELECT button: `CONTROL_CONTROLLER`, `CONTROL_MOUSE` and | ||
53 | `CONTROL_KEYBOARD`. To select the order and available methods set the | ||
54 | `CONTROL_METHODS` macro on compile time. For example, [noodle][noodle] doesn't | ||
55 | make much use of the controller scheme, and we may want to use the mouse as the | ||
56 | default input method. This can be achieved with the following command: | ||
57 | |||
58 | ``` | ||
59 | make run ROM_SRC=roms/noodle.rom CONFIG="-DCONTROL_METHODS=CONTROL_MOUSE,CONTROL_KEYBOARD" | ||
60 | ``` | ||
61 | |||
62 | ### Audio quality | ||
63 | |||
64 | Audio processing can be computationally expensive and the GBA has limited | ||
65 | resources. uxngba supports 4 audio channel devices simultaneously, and depending | ||
66 | on the demands of the rest of the program, the audio quality can be increased or | ||
67 | decreased. By default, sounds will play on a 18157 Hz buffer, which offers | ||
68 | a good quality-performance compromise. A high quality and low-fi audio modes can | ||
69 | be selected by setting the `AUDIO_HIFI` or `AUDIO_LOFI` macros: | ||
70 | |||
71 | ``` | ||
72 | make run ROM_SRC=roms/audio.rom CONFIG="-DAUDIO_HIFI" | ||
73 | |||
74 | or | ||
75 | |||
76 | make run ROM_SRC=roms/audio.rom CONFIG="-DAUDIO_LOFI" | ||
77 | ``` | ||
78 | |||
79 | [noodle]: https://wiki.xxiivv.com/site/noodle.html | ||
@@ -17,6 +17,7 @@ WITH REGARD TO THIS SOFTWARE. | |||
17 | // the pitch table is multiplied by the sampling rate of the original sample, | 17 | // the pitch table is multiplied by the sampling rate of the original sample, |
18 | // the resulting value will be the increment per VSYNC, which must be shifted | 18 | // the resulting value will be the increment per VSYNC, which must be shifted |
19 | // AUDIO_INC_PRECISION to obtain a (20.12) fixed-point increment value. | 19 | // AUDIO_INC_PRECISION to obtain a (20.12) fixed-point increment value. |
20 | // | ||
20 | #if defined(AUDIO_HIFI) | 21 | #if defined(AUDIO_HIFI) |
21 | #define AUDIO_FREQ 40137 | 22 | #define AUDIO_FREQ 40137 |
22 | #define AUDIO_BUF_LEN 672 | 23 | #define AUDIO_BUF_LEN 672 |
@@ -44,7 +45,7 @@ static u16 pitch_table[120] = { | |||
44 | #define AUDIO_BUF_LEN 96 | 45 | #define AUDIO_BUF_LEN 96 |
45 | #define AUDIO_TIMER 62610 | 46 | #define AUDIO_TIMER 62610 |
46 | #define AUDIO_INC_PRECISION 4 | 47 | #define AUDIO_INC_PRECISION 4 |
47 | static u16 pitch_table[120] = { | 48 | static u32 pitch_table[120] = { |
48 | 93, 98, 104, 111, 117, 124, 132, 139, | 49 | 93, 98, 104, 111, 117, 124, 132, 139, |
49 | 148, 157, 166, 176, 186, 197, 209, 222, | 50 | 148, 157, 166, 176, 186, 197, 209, 222, |
50 | 235, 249, 264, 279, 296, 314, 332, 352, | 51 | 235, 249, 264, 279, 296, 314, 332, 352, |
@@ -16,12 +16,9 @@ WITH REGARD TO THIS SOFTWARE. | |||
16 | #include "filesystem.c" | 16 | #include "filesystem.c" |
17 | 17 | ||
18 | #include "rom.c" | 18 | #include "rom.c" |
19 | #include "uxn/uxn.h" | 19 | #include "uxn.c" |
20 | #include "uxn/uxn.c" | 20 | #include "ppu.c" |
21 | #include "uxn/devices/ppu.h" | ||
22 | #include "uxn/devices/ppu.c" | ||
23 | #include "apu.c" | 21 | #include "apu.c" |
24 | |||
25 | #include "text.h" | 22 | #include "text.h" |
26 | 23 | ||
27 | // | 24 | // |
@@ -391,34 +388,12 @@ int main(void) { | |||
391 | init_sound(); | 388 | init_sound(); |
392 | 389 | ||
393 | // Main loop. | 390 | // Main loop. |
394 | int frame_counter = 0; | ||
395 | evaluxn(&u, 0x0100); | 391 | evaluxn(&u, 0x0100); |
396 | u32 flip_cycles = 0; | ||
397 | u32 eval_cycles = 0; | ||
398 | u32 input_cycles = 0; | ||
399 | u32 mix_cycles = 0; | ||
400 | while(true) { | 392 | while(true) { |
401 | bios_vblank_wait(); | 393 | bios_vblank_wait(); |
402 | profile_start(); | ||
403 | handle_input(&u); | 394 | handle_input(&u); |
404 | input_cycles = MAX(profile_stop(), input_cycles); | ||
405 | profile_start(); | ||
406 | evaluxn(&u, mempeek16(devscreen->dat, 0)); | 395 | evaluxn(&u, mempeek16(devscreen->dat, 0)); |
407 | eval_cycles = MAX(profile_stop(), eval_cycles); | ||
408 | txt_position(0, 8); | ||
409 | profile_start(); | ||
410 | flip_cycles = profile_stop(); | ||
411 | frame_counter++; | ||
412 | profile_start(); | ||
413 | sound_mix(); | 396 | sound_mix(); |
414 | mix_cycles = MAX(profile_stop(), mix_cycles); | ||
415 | |||
416 | txt_position(0, 15); | ||
417 | txt_printf("INPUT: %lu \n", input_cycles); | ||
418 | txt_printf("EVAL: %lu \n", eval_cycles); | ||
419 | txt_printf("FLIP: %lu \n", flip_cycles); | ||
420 | txt_printf("MIX: %lu \n", mix_cycles); | ||
421 | txt_printf("FRAME: %lu \n", frame_counter); | ||
422 | flipbuf(&ppu); | 397 | flipbuf(&ppu); |
423 | } | 398 | } |
424 | 399 | ||