#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <assert.h>
#include <SDL.h>
#include <SDL_audio.h>
#include <SDL_opengl.h>
#include "md.h"
#include "rc.h"
#include "rc-vars.h"
#include "pd.h"
#include "pd-defs.h"
#include "font.h"
#include "system.h"
#include "prompt.h"
#include "romload.h"
#include "splash.h"
#include "hqx.h"
#include "scalebit.h"
Classes | |
union | bpp_t |
Generic type for supported colour depths. More... | |
struct | texture |
Framebuffer texture. More... | |
struct | screen |
struct | cbuf_t |
Circular buffer and related functions. More... | |
struct | prompt_command |
struct | filter_data |
struct | filter |
struct | filter_scale_data |
struct | filter_stretch_data |
struct | kb_input_t |
Keyboard input. More... | |
struct | ctl |
Macros | |
#define | HQX_NO_UINT24 |
SDL interface. | |
#define | MESSAGE_LIFE 3000000 |
Number of microseconds to sustain messages. | |
#define | PROMPT_RET_CONT 0x01 |
Prompt return values. | |
#define | PROMPT_RET_EXIT 0x02 |
leave prompt normally | |
#define | PROMPT_RET_ERROR 0x04 |
leave prompt with error | |
#define | PROMPT_RET_ENTER 0x10 |
previous line entered | |
#define | PROMPT_RET_MSG 0x80 |
pd_message() has been used | |
#define | CMD_OK 0x00 |
Extra commands return values. | |
#define | CMD_EINVAL 0x01 |
invalid argument | |
#define | CMD_FAIL 0x02 |
command failed | |
#define | CMD_ERROR 0x03 |
fatal error, DGen should exit | |
#define | CMD_MSG 0x80 |
pd_message() has been used | |
#define | TEXTURE_16_TYPE GL_UNSIGNED_SHORT_5_6_5 |
#define | TEXTURE_32_TYPE GL_UNSIGNED_BYTE |
#define | FILTER_TEXT_ESCAPE "\033" |
Special characters interpreted by filter_text(). | |
#define | FILTER_TEXT_BG_NONE FILTER_TEXT_ESCAPE "\x01\x01" |
#define | FILTER_TEXT_BG_BLACK FILTER_TEXT_ESCAPE "\x01\x02" |
#define | FILTER_TEXT_7X6 FILTER_TEXT_ESCAPE "\x02\x01" |
#define | FILTER_TEXT_8X13 FILTER_TEXT_ESCAPE "\x02\x02" |
#define | FILTER_TEXT_16X26 FILTER_TEXT_ESCAPE "\x02\x03" |
#define | FILTER_TEXT_CENTER FILTER_TEXT_ESCAPE "\x03\x01" |
#define | FILTER_TEXT_LEFT FILTER_TEXT_ESCAPE "\x03\x02" |
#define | FILTER_TEXT_RIGHT FILTER_TEXT_ESCAPE "\x03\x03" |
#define | FILTER_TEXT_IS(f) |
#define | HISTORY_LEN 32 |
#define | DEF 0, 0, 0, 0 |
#define | MOUSE_MOTION_RELEASE_IS_ENABLED(which) (mouse_motion_release.enabled[(which) / 8] & (1 << ((which) % 8))) |
#define | MOUSE_MOTION_RELEASE_DISABLE(which) (mouse_motion_release.enabled[(which) / 8] &= ~(1 << ((which) % 8))) |
#define | MOUSE_MOTION_RELEASE_ENABLE(which) (mouse_motion_release.enabled[(which) / 8] |= (1 << ((which) % 8))) |
#define | MOUSE_SHOW_USECS (unsigned long)(2 * 1000000) |
#define | CE(i, s) { i, s, sizeof(s) } |
Typedefs | |
typedef void | filter_func_t (const struct filter_data *in, struct filter_data *out) |
Functions | |
static void | pd_message_process (void) |
Process status bar message. | |
static size_t | pd_message_write (const char *msg, size_t len, unsigned int mark) |
static size_t | pd_message_display (const char *msg, size_t len, unsigned int mark, bool update) |
static void | pd_message_postpone (const char *msg) |
Postpone a message. | |
static void | pd_message_cursor (unsigned int mark, const char *msg,...) |
Write a message to the status bar while displaying a cursor and without buffering. | |
static void | release_texture (struct texture &) |
static int | init_texture (struct screen *) |
static void | update_texture (struct texture &) |
static int | screen_lock () |
Call this before accessing screen.buf. | |
static void | screen_unlock () |
Call this after accessing screen.buf. | |
static void | screen_update_once () |
Do not call this directly, use screen_update() instead. | |
static void | screen_update () |
Call this after writing into screen.buf. | |
static void | screen_clear () |
Clear screen. | |
void | md_save (md &megad) |
void | md_load (md &megad) |
static void | mdscr_splash () |
Display splash screen. | |
size_t | cbuf_write (cbuf_t *cbuf, uint8_t *src, size_t size) |
Write/copy data into a circular buffer. | |
size_t | cbuf_read (uint8_t *dst, cbuf_t *cbuf, size_t size) |
Read bytes out of a circular buffer. | |
static int | prompt_cmd_exit (class md &, unsigned int, const char **) |
Prompt "exit" command handler. | |
static int | prompt_cmd_load (class md &md, unsigned int ac, const char **av) |
Prompt "load" command handler. | |
static char * | prompt_cmpl_load (class md &, unsigned int, const char **, unsigned int) |
static int | prompt_cmd_unload (class md &, unsigned int, const char **) |
static int | prompt_cmd_reset (class md &, unsigned int, const char **) |
static int | prompt_cmd_unbind (class md &, unsigned int, const char **) |
static char * | prompt_cmpl_unbind (class md &, unsigned int, const char **, unsigned int) |
static int | prompt_cmd_filter_push (class md &, unsigned int, const char **) |
static char * | prompt_cmpl_filter_push (class md &, unsigned int, const char **, unsigned int) |
static int | prompt_cmd_filter_pop (class md &, unsigned int, const char **) |
static int | prompt_cmd_filter_none (class md &, unsigned int, const char **) |
static int | prompt_cmd_calibrate (class md &, unsigned int n_args, const char **args) |
Interactively calibrate a controller. | |
static int | prompt_cmd_config_load (class md &md, unsigned int ac, const char **av) |
Prompt "config_load" command handler. | |
static int | prompt_cmd_config_save (class md &md, unsigned int ac, const char **av) |
Prompt "config_save" command handler. | |
static char * | prompt_cmpl_config_file (class md &, unsigned int, const char **, unsigned int) |
static int | stop_events (md &megad, enum events status) |
static void | restart_events (md &megad) |
static void | freeze (bool toggle) |
unsigned long | pd_usecs (void) |
Elapsed time in microseconds. | |
static void | rehash_prompt_complete_common () |
static int | prompt_rehash_rc_field (const struct rc_field *rc, md &megad) |
Rehash rc vars that require special handling (see "SH" in rc.cpp). | |
static void | set_swab () |
static struct filter * | filters_find (const char *name) |
Return filter structure associated with name. | |
static void | filters_stack_update () |
Update filters data, reallocate extra buffers if necessary. | |
static void | filters_push (const struct filter *f) |
Add filter to stack. | |
static void | filters_insert (const struct filter *f) |
Insert filter at the bottom of the stack. | |
static void | filters_pop () |
Remove last filter from stack. | |
static void | filters_remove (unsigned int index) |
Remove a filter from anywhere in the stack. | |
static void | filters_pluck (const struct filter *f) |
Remove all occurences of filter from the stack. | |
static void | filters_pluck_ctv () |
Remove all occurences of CTV filters from the stack. | |
static void | filters_empty () |
Empty filters stack. | |
static void | do_screenshot (md &megad) |
Take a screenshot. | |
void | pd_help () |
SDL flags help. | |
void | pd_rc () |
Handle rc variables. | |
void | pd_option (char c, const char *) |
Handle the switches. | |
static void | texture_init_id (struct texture &texture) |
static void | texture_init_dlist (struct texture &texture) |
static uint32_t | roundup2 (uint32_t v) |
Round a value up to nearest power of two. | |
static void | filter_off (const struct filter_data *in, struct filter_data *out) |
This filter passes input to output unchanged, only centered or truncated if necessary. | |
template<typename uintX_t > | |
static void | filter_scale_X (const struct filter_data *in, struct filter_data *out) |
static void | filter_scale_3 (const struct filter_data *in, struct filter_data *out) |
static void | filter_scale (const struct filter_data *in, struct filter_data *out) |
This filter attempts to rescale according to screen X/Y factors. | |
template<typename uintX_t > | |
static void | filter_stretch_X (const struct filter_data *in, struct filter_data *out) |
static void | filter_stretch_3 (const struct filter_data *in, struct filter_data *out) |
static void | filter_stretch (const struct filter_data *in, struct filter_data *out) |
This filter stretches the input buffer to fill the entire output. | |
static void | filter_hqx (const struct filter_data *in, struct filter_data *out) |
This filter attempts to rescale with HQX. | |
static void | filter_scale2x (const struct filter_data *in, struct filter_data *out) |
This filter attempts to rescale with Scale2x. | |
static void | filter_blur_32 (const struct filter_data *in, struct filter_data *out) |
static void | filter_blur_24 (const struct filter_data *in, struct filter_data *out) |
static void | filter_blur_16 (const struct filter_data *in, struct filter_data *out) |
static void | filter_blur_15 (const struct filter_data *in, struct filter_data *out) |
static void | filter_blur (const struct filter_data *in, struct filter_data *out) |
static void | filter_scanline_frame (const struct filter_data *in, struct filter_data *out) |
static void | filter_scanline (const struct filter_data *in, struct filter_data *out) |
static void | filter_interlace (const struct filter_data *in, struct filter_data *out) |
static void | filter_swab (const struct filter_data *in, struct filter_data *out) |
static void | filter_text_msg (const char *fmt,...) |
Append message to filter_text_str[]. | |
static void | filter_text (const struct filter_data *in, struct filter_data *out) |
Text overlay filter. | |
static void | manage_calibration (enum rc_binding_type type, intptr_t code) |
Handle input during calibration process. | |
static int | set_scaling (const char *name) |
static int | screen_init (unsigned int width, unsigned int height) |
Initialize screen. | |
static int | set_fullscreen (int toggle) |
Set fullscreen mode. | |
int | pd_graphics_init (int want_sound, int want_pal, int hz) |
Initialize SDL, and the graphics. | |
int | pd_graphics_reinit (int, int want_pal, int hz) |
Reinitialize graphics. | |
void | pd_graphics_palette_update () |
Update palette. | |
void | pd_graphics_update (bool update) |
Display screen. | |
static void | snd_callback (void *, Uint8 *stream, int len) |
Callback for sound. | |
int | pd_sound_init (long &freq, unsigned int &samples) |
Initialize the sound. | |
void | pd_sound_deinit () |
Deinitialize sound subsystem. | |
unsigned int | pd_sound_rp () |
Return samples read/write indices in the buffer. | |
unsigned int | pd_sound_wp () |
void | pd_sound_write () |
Write contents of sndi to sound.cbuf. | |
int | pd_stopped () |
Tells whether DGen stopped intentionally so emulation can resume without skipping frames. | |
static enum kb_input | kb_input (kb_input_t *input, uint32_t ksym, uint16_t ksym_uni) |
Manage text input with some rudimentary history. | |
static void | prompt_show_rc_field (const struct rc_field *rc) |
static int | handle_prompt_enter (class md &md) |
static void | handle_prompt_complete_clear () |
static int | handle_prompt_complete (class md &md, bool rwd) |
static int | handle_prompt (uint32_t ksym, uint16_t ksym_uni, md &megad) |
static int | ctl_pad1 (struct ctl &ctl, md &megad) |
static int | ctl_pad1_release (struct ctl &ctl, md &megad) |
static int | ctl_pad2 (struct ctl &ctl, md &megad) |
static int | ctl_pad2_release (struct ctl &ctl, md &megad) |
static int | ctl_dgen_quit (struct ctl &, md &) |
static int | ctl_dgen_craptv_toggle (struct ctl &, md &) |
static int | ctl_dgen_scaling_toggle (struct ctl &, md &) |
static int | ctl_dgen_reset (struct ctl &, md &megad) |
static int | ctl_dgen_slot (struct ctl &ctl, md &) |
static int | ctl_dgen_slot_next (struct ctl &, md &) |
static int | ctl_dgen_slot_prev (struct ctl &, md &) |
static int | ctl_dgen_save (struct ctl &, md &megad) |
static int | ctl_dgen_load (struct ctl &, md &megad) |
static int | ctl_dgen_z80_toggle (struct ctl &, md &megad) |
static int | ctl_dgen_cpu_toggle (struct ctl &, md &megad) |
static int | ctl_dgen_stop (struct ctl &, md &megad) |
static int | ctl_dgen_prompt (struct ctl &, md &megad) |
static int | ctl_dgen_game_genie (struct ctl &, md &megad) |
static int | ctl_dgen_volume (struct ctl &ctl, md &) |
static int | ctl_dgen_fullscreen_toggle (struct ctl &, md &) |
static int | ctl_dgen_fix_checksum (struct ctl &, md &megad) |
static int | ctl_dgen_screenshot (struct ctl &, md &megad) |
static int | ctl_dgen_debug_enter (struct ctl &, md &megad) |
static void | manage_combos (md &md, bool pressed, enum rc_binding_type type, intptr_t code) |
static bool | check_combos (md &md, struct rc_binding_item item[], unsigned int num) |
static int | manage_bindings (md &md, bool pressed, enum rc_binding_type type, intptr_t code) |
static int | manage_game_genie (md &megad, intptr_t ksym, intptr_t ksym_uni) |
static bool | mouse_is_grabbed () |
static void | mouse_grab (bool grab) |
static void | mouse_motion_delay_release (unsigned int which, bool enable) |
static bool | mouse_motion_released (SDL_Event *event) |
int | pd_handle_events (md &megad) |
void | pd_message (const char *msg,...) |
Write a message to the status bar. | |
void | pd_clear_message () |
void | pd_show_carthead (md &megad) |
void | pd_quit () |
Variables | |
static struct screen | screen |
struct { | |
const unsigned int width | |
320 | |
unsigned int height | |
224 or 240 (NTSC_VBLANK or PAL_VBLANK) | |
unsigned int hz | |
refresh rate | |
unsigned int is_pal: 1 | |
PAL enabled. | |
uint8_t palette [256] | |
palette for 8bpp modes (mdpal) | |
} | video |
int | slot |
struct bmap | mdscr |
unsigned char * | mdpal = NULL |
struct sndinfo | sndi |
const char * | pd_options = "fX:Y:S:G:" |
struct { | |
unsigned int rate | |
samples rate | |
unsigned int samples | |
number of samples required by the callback | |
cbuf_t cbuf | |
circular buffer | |
} | sound |
Sound. | |
struct { | |
unsigned int displayed:1 | |
whether message is currently displayed | |
unsigned long since | |
since this number of microseconds | |
size_t length | |
remaining length to display | |
char message [2048] | |
message | |
} | info |
Messages. | |
struct { | |
struct prompt status | |
prompt status | |
char ** complete | |
completion results array | |
unsigned int skip | |
number of entries to skip in the array | |
unsigned int common | |
common length of all entries | |
} | prompt |
Prompt. | |
static struct prompt_command | prompt_command [] |
List of commands to auto complete. | |
static int | stopped = 0 |
Stopped flag used by pd_stopped() | |
static enum events | events |
static const char | stopped_str [] = "STOPPED." |
Messages shown whenever events are stopped. | |
static const char | prompt_str [] = ":" |
static const char | game_genie_str [] = "Enter Game Genie/Hex code: " |
bool | pd_freeze = false |
Enable emulation by default. | |
static unsigned int | pd_freeze_ref = 0 |
static filter_func_t | filter_scale |
static filter_func_t | filter_off |
static filter_func_t | filter_stretch |
static filter_func_t | filter_scale2x |
static filter_func_t | filter_hqx |
static filter_func_t | filter_blur |
static filter_func_t | filter_scanline |
static filter_func_t | filter_interlace |
static filter_func_t | filter_swab |
static struct filter | filters_available [] |
static unsigned int | filters_stack_size |
static bool | filters_stack_default |
static struct filter * | filters_stack [64] |
static bpp_t | filters_stack_data_buf [2] |
static struct filter_data | filters_stack_data [1+elemof(filters_stack)] |
static char | filter_text_str [2048] |
static struct filter | filter_text_def |
static bool | calibrating = false |
static unsigned int | calibrating_controller |
Controller being calibrated. | |
static struct ctl | control [] |
struct { | |
char const * name | |
Controller button name. | |
enum ctl_e const id [2] | |
Controls indices in control[]. | |
bool once | |
If button has been pressed once. | |
bool twice | |
If button has been pressed twice. | |
enum rc_binding_type type | |
Type of code. | |
intptr_t code | |
Temporary code. | |
} | calibration_steps [] |
static struct rc_binding_item | combos [64] |
struct { | |
unsigned long when [0x100] | |
uint8_t enabled [0x100/8] | |
unsigned int count | |
} | mouse_motion_release |
#define CMD_EINVAL 0x01 |
invalid argument
#define CMD_ERROR 0x03 |
fatal error, DGen should exit
#define CMD_FAIL 0x02 |
command failed
#define CMD_MSG 0x80 |
pd_message() has been used
#define CMD_OK 0x00 |
Extra commands return values.
command successful
#define DEF 0, 0, 0, 0 |
#define FILTER_TEXT_16X26 FILTER_TEXT_ESCAPE "\x02\x03" |
#define FILTER_TEXT_7X6 FILTER_TEXT_ESCAPE "\x02\x01" |
#define FILTER_TEXT_8X13 FILTER_TEXT_ESCAPE "\x02\x02" |
#define FILTER_TEXT_BG_BLACK FILTER_TEXT_ESCAPE "\x01\x02" |
#define FILTER_TEXT_BG_NONE FILTER_TEXT_ESCAPE "\x01\x01" |
#define FILTER_TEXT_CENTER FILTER_TEXT_ESCAPE "\x03\x01" |
#define FILTER_TEXT_ESCAPE "\033" |
Special characters interpreted by filter_text().
FILTER_TEXT_BG_NONE transparent background. FILTER_TEXT_BG_BLACK black background. FILTER_TEXT_7X6 use 7x6 font. FILTER_TEXT_8X13 use 8x13 font. FILTER_TEXT_16X26 use 16x26 font. FILTER_TEXT_CENTER center justify. FILTER_TEXT_LEFT left justify. FILTER_TEXT_RIGHT right justify.
#define FILTER_TEXT_IS | ( | f | ) |
#define FILTER_TEXT_LEFT FILTER_TEXT_ESCAPE "\x03\x02" |
#define FILTER_TEXT_RIGHT FILTER_TEXT_ESCAPE "\x03\x03" |
#define HISTORY_LEN 32 |
#define HQX_NO_UINT24 |
SDL interface.
#define MESSAGE_LIFE 3000000 |
Number of microseconds to sustain messages.
#define MOUSE_MOTION_RELEASE_DISABLE | ( | which | ) | (mouse_motion_release.enabled[(which) / 8] &= ~(1 << ((which) % 8))) |
#define MOUSE_MOTION_RELEASE_ENABLE | ( | which | ) | (mouse_motion_release.enabled[(which) / 8] |= (1 << ((which) % 8))) |
#define MOUSE_MOTION_RELEASE_IS_ENABLED | ( | which | ) | (mouse_motion_release.enabled[(which) / 8] & (1 << ((which) % 8))) |
#define MOUSE_SHOW_USECS (unsigned long)(2 * 1000000) |
#define PROMPT_RET_CONT 0x01 |
Prompt return values.
waiting for more input
#define PROMPT_RET_ENTER 0x10 |
previous line entered
#define PROMPT_RET_ERROR 0x04 |
leave prompt with error
#define PROMPT_RET_EXIT 0x02 |
leave prompt normally
#define PROMPT_RET_MSG 0x80 |
pd_message() has been used
#define TEXTURE_16_TYPE GL_UNSIGNED_SHORT_5_6_5 |
#define TEXTURE_32_TYPE GL_UNSIGNED_BYTE |
typedef void filter_func_t(const struct filter_data *in, struct filter_data *out) |
enum ctl_e |
enum events |
enum kb_input |
size_t cbuf_read | ( | uint8_t * | dst, |
cbuf_t * | cbuf, | ||
size_t | size | ||
) |
Read bytes out of a circular buffer.
[out] | dst | Destination buffer. |
[in,out] | cbuf | Circular buffer to read from. |
size | Maximum number of bytes to copy to dst. |
size_t cbuf_write | ( | cbuf_t * | cbuf, |
uint8_t * | src, | ||
size_t | size | ||
) |
Write/copy data into a circular buffer.
[in,out] | cbuf | Destination buffer. |
[in] | src | Buffer to copy from. |
size | Size of src. |
|
static |
|
static |
Take a screenshot.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
This filter attempts to rescale with HQX.
in | Input buffer data. |
out | Output buffer data. |
|
static |
|
static |
This filter passes input to output unchanged, only centered or truncated if necessary.
Doesn't have any fallback, thus cannot fail.
in | Input buffer data. |
out | Output buffer data. |
|
static |
This filter attempts to rescale according to screen X/Y factors.
in | Input buffer data. |
out | Output buffer data. |
|
static |
This filter attempts to rescale with Scale2x.
in | Input buffer data. |
out | Output buffer data. |
|
static |
|
static |
|
static |
|
static |
|
static |
This filter stretches the input buffer to fill the entire output.
in | Input buffer data. |
out | Output buffer data. |
|
static |
|
static |
|
static |
|
static |
Text overlay filter.
in | Input buffer data. |
out | Output buffer data. |
|
static |
Append message to filter_text_str[].
|
static |
Empty filters stack.
|
staticread |
Return filter structure associated with name.
name | Name of filter. |
|
static |
Insert filter at the bottom of the stack.
f | Filter to insert. |
|
static |
Remove all occurences of filter from the stack.
f | Filter to remove. |
|
static |
Remove all occurences of CTV filters from the stack.
|
static |
Remove last filter from stack.
|
static |
Add filter to stack.
f | Filter to add. |
|
static |
Remove a filter from anywhere in the stack.
index | Filters stack index. |
|
static |
Update filters data, reallocate extra buffers if necessary.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Manage text input with some rudimentary history.
input | Input buffer. |
ksym | Keyboard symbol. |
ksym_uni | Unicode translation for keyboard symbol. |
|
static |
|
static |
Handle input during calibration process.
type | Type of code. |
code | Code to process. |
|
static |
|
static |
void md_load | ( | md & | megad | ) |
void md_save | ( | md & | megad | ) |
|
static |
Display splash screen.
|
static |
|
static |
|
static |
|
static |
void pd_clear_message | ( | ) |
int pd_graphics_init | ( | int | want_sound, |
int | want_pal, | ||
int | hz | ||
) |
Initialize SDL, and the graphics.
want_sound | Nonzero if we want sound. |
want_pal | Nonzero for PAL mode. |
hz | Requested frame rate (between 0 and 1000). |
void pd_graphics_palette_update | ( | ) |
Update palette.
int pd_graphics_reinit | ( | int | , |
int | want_pal, | ||
int | hz | ||
) |
Reinitialize graphics.
want_pal | Nonzero for PAL mode. |
hz | Requested frame rate (between 0 and 1000). |
void pd_graphics_update | ( | bool | update | ) |
Display screen.
update | False if screen buffer is garbage and must be updated first. |
int pd_handle_events | ( | md & | megad | ) |
void pd_help | ( | ) |
SDL flags help.
void pd_message | ( | const char * | msg, |
... | |||
) |
Write a message to the status bar.
|
static |
Write a message to the status bar while displaying a cursor and without buffering.
|
static |
|
static |
Postpone a message.
|
static |
Process status bar message.
|
static |
void pd_option | ( | char | c, |
const char * | |||
) |
Handle the switches.
c | Switch's value. |
void pd_quit | ( | ) |
void pd_rc | ( | ) |
Handle rc variables.
void pd_show_carthead | ( | md & | megad | ) |
void pd_sound_deinit | ( | ) |
Deinitialize sound subsystem.
int pd_sound_init | ( | long & | freq, |
unsigned int & | samples | ||
) |
Initialize the sound.
freq | Sound samples rate. | |
[in,out] | samples | Minimum buffer size in samples. |
unsigned int pd_sound_rp | ( | ) |
Return samples read/write indices in the buffer.
unsigned int pd_sound_wp | ( | ) |
void pd_sound_write | ( | ) |
Write contents of sndi to sound.cbuf.
int pd_stopped | ( | ) |
Tells whether DGen stopped intentionally so emulation can resume without skipping frames.
unsigned long pd_usecs | ( | void | ) |
Elapsed time in microseconds.
|
static |
Interactively calibrate a controller.
If n_args == 1, controller 0 will be configured. If n_args == 2, configure controller in string args[1].
n_args | Number of arguments. | |
[in] | args | List of arguments. |
|
static |
Prompt "config_load" command handler.
md | Context. |
ac | Number of arguments in av. |
av | Arguments. |
|
static |
Prompt "config_save" command handler.
md | Context. |
ac | Number of arguments in av. |
av | Arguments. |
|
static |
Prompt "exit" command handler.
|
static |
|
static |
|
static |
|
static |
Prompt "load" command handler.
md | Context. |
ac | Number of arguments in av. |
av | Arguments. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Rehash rc vars that require special handling (see "SH" in rc.cpp).
|
static |
|
static |
|
static |
|
static |
|
static |
Round a value up to nearest power of two.
v | Value. |
|
static |
Clear screen.
|
static |
Initialize screen.
width | Width of display. |
height | Height of display. |
|
static |
Call this before accessing screen.buf.
No syscalls allowed before screen_unlock().
|
static |
Call this after accessing screen.buf.
|
static |
Call this after writing into screen.buf.
|
static |
Do not call this directly, use screen_update() instead.
|
static |
Set fullscreen mode.
toggle | Nonzero to enable fullscreen, otherwise disable it. |
|
static |
|
static |
|
static |
Callback for sound.
stream | Sound destination buffer. |
len | Length of destination buffer. |
|
static |
|
static |
|
static |
|
static |
|
static |
Controller being calibrated.
struct { ... } calibration_steps[] |
cbuf_t cbuf |
circular buffer
intptr_t code |
Temporary code.
|
static |
unsigned int common |
common length of all entries
char** complete |
completion results array
|
static |
unsigned int count |
unsigned int displayed |
whether message is currently displayed
uint8_t enabled[0x100/8] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
unsigned int height |
224 or 240 (NTSC_VBLANK or PAL_VBLANK)
unsigned int hz |
refresh rate
enum ctl_e const id[2] |
Controls indices in control[].
struct { ... } info |
Messages.
unsigned int is_pal |
PAL enabled.
size_t length |
remaining length to display
unsigned char* mdpal = NULL |
struct bmap mdscr |
char message[2048] |
message
struct { ... } mouse_motion_release |
char const* name |
Controller button name.
bool once |
If button has been pressed once.
uint8_t palette[256] |
palette for 8bpp modes (mdpal)
bool pd_freeze = false |
Enable emulation by default.
|
static |
const char* pd_options = "fX:Y:S:G:" |
struct { ... } prompt |
Prompt.
|
static |
List of commands to auto complete.
|
static |
unsigned int rate |
samples rate
unsigned int samples |
number of samples required by the callback
unsigned long since |
since this number of microseconds
unsigned int skip |
number of entries to skip in the array
int slot |
struct sndinfo sndi |
struct { ... } sound |
Sound.
struct prompt status |
prompt status
|
static |
Stopped flag used by pd_stopped()
|
static |
Messages shown whenever events are stopped.
bool twice |
If button has been pressed twice.
enum rc_binding_type type |
Type of code.
struct { ... } video |
unsigned long when[0x100] |
const unsigned int width |
320