mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
updated tamagotchi (added muted button)
thanks Smileycathy1128!
This commit is contained in:
@@ -11,9 +11,12 @@ Create a `tama_p1` folder in your microSD card, and put the ROM as `rom.bin`.
|
|||||||
Use a search engine to find the Tamagotchi ROM. There is a file named `a`.
|
Use a search engine to find the Tamagotchi ROM. There is a file named `a`.
|
||||||
Rename this to `rom.bin`.
|
Rename this to `rom.bin`.
|
||||||
|
|
||||||
Left button is A, OK is B, and right button is C. Hold the back button to exit.
|
- Left button is A.
|
||||||
There is currently no saving, so your progress will be reset when you exit the
|
- OK is B.
|
||||||
app.
|
- Right button is C.
|
||||||
|
- Holding the Up button functions the same as press both A and C, which mutes the volume.
|
||||||
|
- Hold the Back button to save and exit.
|
||||||
|
|
||||||
|
|
||||||
Building
|
Building
|
||||||
--------
|
--------
|
||||||
@@ -34,7 +37,7 @@ Note: you may also need to add `-Wno-unused-parameter` to `CCFLAGS` in
|
|||||||
Debugging
|
Debugging
|
||||||
---------
|
---------
|
||||||
Using the serial script from [FlipperScripts](https://github.com/DroomOne/FlipperScripts/blob/main/serial_logger.py)
|
Using the serial script from [FlipperScripts](https://github.com/DroomOne/FlipperScripts/blob/main/serial_logger.py)
|
||||||
it is easy to add direct logging after running the appliation:
|
it is easy to add direct logging after running the application:
|
||||||
`python .\serial_logger.py`
|
`python .\serial_logger.py`
|
||||||
|
|
||||||
`./fbt launch_app APPSRC=applications\plugins\tama_p1; python .\serial_logger.py`
|
`./fbt launch_app APPSRC=applications\plugins\tama_p1; python .\serial_logger.py`
|
||||||
@@ -45,11 +48,12 @@ Implemented
|
|||||||
- Basic emulation
|
- Basic emulation
|
||||||
- Input
|
- Input
|
||||||
- Sound
|
- Sound
|
||||||
- Saving/Loading emaulator state (stored in `/ext/tama_p1/save.bin`)
|
- Saving/Loading emulator state (stored in `/ext/tama_p1/save.bin`)
|
||||||
|
- Mute button combo shortcut (Up = A+C)
|
||||||
|
|
||||||
To-do
|
To-do
|
||||||
-----
|
-----
|
||||||
- Slots
|
- more than one save slot
|
||||||
- In-game reset
|
- In-game reset
|
||||||
- Test mode?
|
- Test mode?
|
||||||
- Volume adjustment
|
- Volume adjustment
|
||||||
|
|||||||
BIN
applications/plugins/tama_p1/tama.gif
Normal file
BIN
applications/plugins/tama_p1/tama.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
@@ -38,9 +38,20 @@ static void tama_p1_draw_callback(Canvas* const canvas, void* cb_ctx) {
|
|||||||
// FURI_LOG_D(TAG, "Drawing frame");
|
// FURI_LOG_D(TAG, "Drawing frame");
|
||||||
// Calculate positioning
|
// Calculate positioning
|
||||||
uint16_t canv_width = canvas_width(canvas);
|
uint16_t canv_width = canvas_width(canvas);
|
||||||
|
uint16_t canv_height = canvas_height(canvas);
|
||||||
uint16_t lcd_matrix_scaled_width = 32 * TAMA_SCREEN_SCALE_FACTOR;
|
uint16_t lcd_matrix_scaled_width = 32 * TAMA_SCREEN_SCALE_FACTOR;
|
||||||
uint16_t lcd_matrix_top = 0;
|
uint16_t lcd_matrix_scaled_height = 16 * TAMA_SCREEN_SCALE_FACTOR;
|
||||||
|
// uint16_t lcd_matrix_top = 0;
|
||||||
|
uint16_t lcd_matrix_top = (canv_height - lcd_matrix_scaled_height) / 2;
|
||||||
uint16_t lcd_matrix_left = (canv_width - lcd_matrix_scaled_width) / 2;
|
uint16_t lcd_matrix_left = (canv_width - lcd_matrix_scaled_width) / 2;
|
||||||
|
|
||||||
|
uint16_t lcd_icon_upper_top = lcd_matrix_top - TAMA_LCD_ICON_SIZE - TAMA_LCD_ICON_MARGIN;
|
||||||
|
uint16_t lcd_icon_upper_left = lcd_matrix_left;
|
||||||
|
uint16_t lcd_icon_lower_top =
|
||||||
|
lcd_matrix_top + lcd_matrix_scaled_height + TAMA_LCD_ICON_MARGIN;
|
||||||
|
uint16_t lcd_icon_lower_left = lcd_matrix_left;
|
||||||
|
uint16_t lcd_icon_spacing_horiz =
|
||||||
|
(lcd_matrix_scaled_width - (4 * TAMA_LCD_ICON_SIZE)) / 3 + TAMA_LCD_ICON_SIZE;
|
||||||
|
|
||||||
|
|
||||||
uint16_t y = lcd_matrix_top;
|
uint16_t y = lcd_matrix_top;
|
||||||
@@ -58,20 +69,32 @@ static void tama_p1_draw_callback(Canvas* const canvas, void* cb_ctx) {
|
|||||||
y += TAMA_SCREEN_SCALE_FACTOR;
|
y += TAMA_SCREEN_SCALE_FACTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw Icons on bottom
|
// Start drawing icons
|
||||||
uint8_t lcd_icons = g_ctx->icons;
|
uint8_t lcd_icons = g_ctx->icons;
|
||||||
uint16_t x_ic = 0;
|
|
||||||
y = 64 - TAMA_LCD_ICON_SIZE;
|
// Draw top icons
|
||||||
for(uint8_t i = 0; i < 7; ++i) {
|
y = lcd_icon_upper_top;
|
||||||
|
// y = 64 - TAMA_LCD_ICON_SIZE;
|
||||||
|
uint16_t x_ic = lcd_icon_upper_left;
|
||||||
|
for(uint8_t i = 0; i < 4; ++i) {
|
||||||
if(lcd_icons & 1) {
|
if(lcd_icons & 1) {
|
||||||
canvas_draw_icon(canvas, x_ic, y, icons_list[i]);
|
canvas_draw_icon(canvas, x_ic, y, icons_list[i]);
|
||||||
}
|
}
|
||||||
x_ic += TAMA_LCD_ICON_SIZE + 4;
|
// x_ic += TAMA_LCD_ICON_SIZE + 4;
|
||||||
|
x_ic += lcd_icon_spacing_horiz;
|
||||||
lcd_icons >>= 1;
|
lcd_icons >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcd_icons & 7) {
|
// Draw bottom icons
|
||||||
canvas_draw_icon(canvas, 128 - TAMA_LCD_ICON_SIZE, 0, icons_list[7]);
|
y = lcd_icon_lower_top;
|
||||||
|
x_ic = lcd_icon_lower_left;
|
||||||
|
for(uint8_t i = 4; i < 8; ++i) {
|
||||||
|
// canvas_draw_frame(canvas, x_ic, y, TAMA_LCD_ICON_SIZE, TAMA_LCD_ICON_SIZE);
|
||||||
|
if(lcd_icons & 1) {
|
||||||
|
canvas_draw_icon(canvas, x_ic, y, icons_list[i]);
|
||||||
|
}
|
||||||
|
x_ic += lcd_icon_spacing_horiz;
|
||||||
|
lcd_icons >>= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,8 +114,6 @@ static void tama_p1_update_timer_callback(FuriMessageQueue* event_queue) {
|
|||||||
TamaEvent event = {.type = EventTypeTick};
|
TamaEvent event = {.type = EventTypeTick};
|
||||||
furi_message_queue_put(event_queue, &event, 0);
|
furi_message_queue_put(event_queue, &event, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void tama_p1_load_state() {
|
static void tama_p1_load_state() {
|
||||||
state_t *state;
|
state_t *state;
|
||||||
@@ -204,7 +225,6 @@ static void tama_p1_save_state() {
|
|||||||
|
|
||||||
// Saving state
|
// Saving state
|
||||||
FURI_LOG_D(TAG, "Saving Gamestate");
|
FURI_LOG_D(TAG, "Saving Gamestate");
|
||||||
|
|
||||||
uint8_t buf[4];
|
uint8_t buf[4];
|
||||||
state_t *state;
|
state_t *state;
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
@@ -465,6 +485,14 @@ int32_t tama_p1_app(void* p) {
|
|||||||
tamalib_set_button(BTN_MIDDLE, tama_btn_state);
|
tamalib_set_button(BTN_MIDDLE, tama_btn_state);
|
||||||
} else if(event.input.key == InputKeyRight) {
|
} else if(event.input.key == InputKeyRight) {
|
||||||
tamalib_set_button(BTN_RIGHT, tama_btn_state);
|
tamalib_set_button(BTN_RIGHT, tama_btn_state);
|
||||||
|
} else if(event.input.key == InputKeyDown && event.input.type == InputTypeShort) {
|
||||||
|
// TODO: pause or fast-forward tamagotchi
|
||||||
|
tama_p1_save_state();
|
||||||
|
} else if(event.input.key == InputKeyUp) { // mute tamagotchi
|
||||||
|
tamalib_set_button(BTN_LEFT, tama_btn_state);
|
||||||
|
tamalib_set_button(BTN_RIGHT, tama_btn_state);
|
||||||
|
} else if(event.input.key == InputKeyBack && event.input.type == InputTypeShort) {
|
||||||
|
tama_p1_save_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user