2009-05-21 17:48:31 +02:00
|
|
|
/* gameplaySP
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Exophase <exophase@gmail.com>
|
|
|
|
*
|
|
|
|
* 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 2 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MAIN_H
|
|
|
|
#define MAIN_H
|
|
|
|
|
2020-10-06 03:09:13 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2021-10-15 21:28:40 +02:00
|
|
|
#define TIMER_INACTIVE 0
|
|
|
|
#define TIMER_PRESCALE 1
|
|
|
|
#define TIMER_CASCADE 2
|
2009-05-21 17:48:31 +02:00
|
|
|
|
2021-10-15 21:28:40 +02:00
|
|
|
#define TIMER_NO_IRQ 0
|
|
|
|
#define TIMER_TRIGGER_IRQ 1
|
2009-05-21 17:48:31 +02:00
|
|
|
|
2021-10-15 21:28:40 +02:00
|
|
|
#define TIMER_DS_CHANNEL_NONE 0
|
|
|
|
#define TIMER_DS_CHANNEL_A 1
|
|
|
|
#define TIMER_DS_CHANNEL_B 2
|
|
|
|
#define TIMER_DS_CHANNEL_BOTH 3
|
2009-05-21 17:48:31 +02:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
s32 count;
|
|
|
|
u32 reload;
|
|
|
|
u32 prescale;
|
2011-09-06 19:18:34 +02:00
|
|
|
fixed8_24 frequency_step;
|
2021-10-15 21:28:40 +02:00
|
|
|
u32 direct_sound_channels;
|
|
|
|
u32 irq;
|
|
|
|
u32 status;
|
2009-05-21 17:48:31 +02:00
|
|
|
} timer_type;
|
|
|
|
|
2019-11-11 20:03:13 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
2020-10-24 15:58:40 +02:00
|
|
|
no_frameskip = 0,
|
2019-11-11 20:03:13 +01:00
|
|
|
auto_frameskip,
|
2020-10-24 15:58:40 +02:00
|
|
|
auto_threshold_frameskip,
|
|
|
|
fixed_interval_frameskip
|
2019-11-11 20:03:13 +01:00
|
|
|
} frameskip_type;
|
|
|
|
|
2021-03-22 21:45:52 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
auto_detect = 0,
|
|
|
|
builtin_bios,
|
|
|
|
official_bios
|
|
|
|
} bios_type;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
boot_game = 0,
|
|
|
|
boot_bios
|
|
|
|
} boot_mode;
|
|
|
|
|
2023-06-15 20:12:39 +02:00
|
|
|
extern u32 gbc_update_count;
|
|
|
|
|
2009-05-21 17:48:31 +02:00
|
|
|
extern u32 cpu_ticks;
|
|
|
|
extern u32 execute_cycles;
|
2019-11-11 20:03:13 +01:00
|
|
|
extern u32 skip_next_frame;
|
2009-05-21 17:48:31 +02:00
|
|
|
|
|
|
|
extern u32 flush_ram_count;
|
|
|
|
|
2011-09-05 18:31:58 +02:00
|
|
|
extern char main_path[512];
|
2009-05-21 17:48:31 +02:00
|
|
|
|
2023-09-06 00:48:37 +02:00
|
|
|
#define cycles_to_run(c) ((c) & 0x7FFF)
|
|
|
|
#define completed_frame(c) ((c) & 0x80000000)
|
2023-01-12 00:16:39 +01:00
|
|
|
u32 function_cc update_gba(int remaining_cycles);
|
2014-12-10 15:47:19 +01:00
|
|
|
void reset_gba(void);
|
2014-12-10 12:53:26 +01:00
|
|
|
|
2014-12-10 15:47:19 +01:00
|
|
|
void init_main(void);
|
2014-12-10 12:53:26 +01:00
|
|
|
|
2011-09-05 18:31:58 +02:00
|
|
|
void game_name_ext(char *src, char *buffer, char *extension);
|
2023-09-07 20:26:44 +02:00
|
|
|
|
|
|
|
bool main_check_savestate(const u8 *src);
|
2021-08-24 17:15:27 +02:00
|
|
|
unsigned main_write_savestate(u8* ptr);
|
|
|
|
bool main_read_savestate(const u8 *src);
|
2009-05-21 17:48:31 +02:00
|
|
|
|
|
|
|
extern u32 num_skipped_frames;
|
2014-12-10 17:06:09 +01:00
|
|
|
extern int dynarec_enable;
|
2021-03-22 21:45:52 +01:00
|
|
|
extern boot_mode selected_boot_mode;
|
2023-09-01 23:57:57 +02:00
|
|
|
extern int sprite_limit;
|
2009-05-21 17:48:31 +02:00
|
|
|
|
2022-04-09 08:50:38 +02:00
|
|
|
#ifdef TRACE_REGISTERS
|
2021-12-11 11:27:59 +01:00
|
|
|
void print_regs(void);
|
2022-04-09 08:50:38 +02:00
|
|
|
#endif
|
2009-05-21 17:48:31 +02:00
|
|
|
|
2023-04-15 02:02:17 +02:00
|
|
|
#ifdef TRACE_EVENTS
|
|
|
|
#define trace_update_gba(remcyc) \
|
|
|
|
printf("update_gba: %d remaining cycles\n", (remcyc));
|
|
|
|
#else /* TRACE_EVENTS */
|
|
|
|
#define trace_update_gba(x)
|
|
|
|
#endif
|
|
|
|
|
2009-05-21 17:48:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|