Files
WizzardSK a563bb5e97 Base the dosbox core on dosbox-core, with ZIP support and more from DOSBox Pure
The core is replaced by dosbox-core as of libretro/dosbox-core d38fcb50 (its
history is in that repository), with the following on top:

- Frontend VFS for mounted drives (libretro/dosbox-core#11): Android content://
  and saf:// content works.
- Built as dosbox_libretro and called DOSBox, so it installs next to
  dosbox-core without sharing its options, saves directory or config file.
  Option keys keep their dosbox_core_ prefix.
- ZIP files as content, from DOSBox Pure (Bernhard Schelling): its zipDrive,
  unionDrive and memoryDrive, and the helpers they share (drive_dbp.cpp). The
  archive is mounted as C: without being extracted and the game's changes go
  to <name>.save.zip in the saves directory. DOS_Drive and DOS_File get the
  few members those drives need, with defaults.
- The game in a ZIP is started when there is nothing to choose: the single
  program in the root, or in the one folder the root holds, leaving setup and
  install programs aside.
- Disk images inside a ZIP: CD images (cue sheets with data and audio tracks,
  or ISOs) as D:, floppy images as A:, hard disk images as E: and on. Files on
  emulated drives can be named "$C:\PATH" as in DOSBox Pure; host_stat,
  fopen_wrap, the CD image reader and the audio track decoder open them
  through the drive, finding files by their long names. CDs and floppies go
  to RetroArch's disc control.
- A start menu after DOSBox Pure's when a ZIP leaves a choice: it lists the
  programs on C: and on the mounted images, starts the one picked, can make it
  start on its own next time (kept in C:\DOSBOX.RUN, in the save file), and
  comes back when the program exits. Keyboard and gamepad; it can be turned
  off in the core options.
- Automatic gamepad mapping from DOSBox Pure's Keyb2Joypad database (original
  data by Jemy Murphy and bigjim, used by DOSBox Pure with permission): a game
  the database knows, as a ZIP or from a directory, gets its keys, mouse and
  joystick actions on the first gamepad instead of the DOS joystick, with the
  action names shown in RetroArch. It can be turned off.
- The CPU speed from the game's year, from its name or the database, as in
  DOSBox Pure; it can be turned off.
- Roland SC-55 MIDI with Nuked-SC55 (nukeykt), from DOSBox Pure, as a new MIDI
  driver taking the module's ROMs from the system directory.
2026-09-28 01:41:33 +02:00

112 lines
3.0 KiB
C++

/*
* Copyright (C) 2002-2021 The DOSBox Team
*
* 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 DOSBOX_CALLBACK_H
#define DOSBOX_CALLBACK_H
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
typedef Bitu (*CallBack_Handler)(void);
extern CallBack_Handler CallBack_Handlers[];
enum { CB_RETN,CB_RETF,CB_RETF8,CB_RETF_STI,CB_RETF_CLI,
CB_IRET,CB_IRETD,CB_IRET_STI,CB_IRET_EOI_PIC1,
CB_IRQ0,CB_IRQ1,CB_IRQ9,CB_IRQ12,CB_IRQ12_RET,CB_IRQ6_PCJR,CB_MOUSE,
CB_INT29,CB_INT16,CB_HOOKABLE,CB_TDE_IRET,CB_IPXESR,CB_IPXESR_RET,
CB_INT21,CB_INT13,CB_VESA_WAIT,CB_VESA_PM };
#define CB_MAX 128
#define CB_SIZE 32
#define CB_SEG 0xF000
#define CB_SOFFSET 0x1000
enum {
CBRET_NONE=0,CBRET_STOP=1
};
extern Bit8u lastint;
static INLINE RealPt CALLBACK_RealPointer(Bitu callback) {
return RealMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE));
}
static INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) {
return PhysMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE));
}
static INLINE PhysPt CALLBACK_GetBase(void) {
return (CB_SEG << 4) + CB_SOFFSET;
}
Bitu CALLBACK_Allocate();
void CALLBACK_Idle(void);
void CALLBACK_RunRealInt(Bit8u intnum);
void CALLBACK_RunRealFar(Bit16u seg,Bit16u off);
bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,const char* descr);
Bitu CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,PhysPt addr,const char* descr);
const char* CALLBACK_GetDescription(Bitu callback);
bool CALLBACK_Free(Bitu callback);
void CALLBACK_SCF(bool val);
void CALLBACK_SZF(bool val);
void CALLBACK_SIF(bool val);
extern Bitu call_priv_io;
class CALLBACK_HandlerObject{
private:
bool installed;
Bitu m_callback;
enum {NONE,SETUP,SETUPAT} m_type;
struct {
RealPt old_vector;
Bit8u interrupt;
bool installed;
} vectorhandler;
public:
CALLBACK_HandlerObject():installed(false),m_type(NONE) {
vectorhandler.installed=false;
}
~CALLBACK_HandlerObject();
//Install and allocate a callback.
void Install(CallBack_Handler handler,Bitu type,const char* description);
void Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description);
void Uninstall();
//Only allocate a callback number
void Allocate(CallBack_Handler handler,const char* description=0);
Bit16u Get_callback() {
return (Bit16u)m_callback;
}
RealPt Get_RealPointer() {
return CALLBACK_RealPointer(m_callback);
}
void Set_RealVec(Bit8u vec);
};
#endif