/******************************************************************************
*
* Copyright (C) 2024  Brian Berlin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************
*
* FILENAME: launcher.h
*
* DESCRIPTION:  This contains function declarations for the ROM launcher
*
* AUTHORS:  bberlin
*
* CHANGE LOG
*
*  VER     DATE     CHANGED BY   DESCRIPTION OF CHANGE
* ------  --------  ----------   ------------------------------------
* 0.9.1   01/01/24  bberlin      Creation
******************************************************************************/
#ifndef LAUNCHER_H_
#define LAUNCHER_H_

#include "widget.h"

/* Launcher sections (for button row) */
#define LAUNCHER_SECTION_ROM_LIST    0
#define LAUNCHER_SECTION_ROM_ACTIONS 1
#define LAUNCHER_SECTION_ROM_OPTIONS 2
#define LAUNCHER_SECTION_VIEW_OPTIONS 3

/* Attach To options - these are local indices for the selector, not cart types */
#define ATTACH_TO_INDEX_CART     0
#define ATTACH_TO_INDEX_CASSETTE 1
#define ATTACH_TO_INDEX_DISK_1   2
#define ATTACH_TO_INDEX_DISK_8   9

/* ROM list entry */
typedef struct {
    char title[128];
    unsigned int crc;
} t_rom_entry;

/* Initialize launcher */
void launcher_init(void);

/* Cleanup launcher */
void launcher_cleanup(void);

/* Render launcher menu row (replaces guitop_menu_row for launcher) */
int launcher_menu_row(struct nk_context *ctx);

/* Render ROM list section */
void launcher_render_rom_list(struct nk_context *ctx);

/* Build menu options for current section */
int launcher_build_menu(struct option_widget *wid_ary);

/* Launch the currently selected ROM (sets config.general.rom and calls gui_launch) */
void launcher_launch_rom(void);

/* Check if launcher is active */
int launcher_is_active(void);

/* Get current section */
int launcher_get_section(void);

#endif
