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

148 lines
3.9 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_SHELL_H
#define DOSBOX_SHELL_H
#include <ctype.h>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_PROGRAMS_H
#include "programs.h"
#endif
#include <string>
#include <list>
#define CMD_MAXLINE 4096
#define CMD_MAXCMDS 20
#define CMD_OLDSIZE 4096
extern Bitu call_shellstop;
class DOS_Shell;
/* first_shell is used to add and delete stuff from the shell env
* by "external" programs. (config) */
extern DOS_Shell * first_shell;
class BatchFile {
public:
BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line);
virtual ~BatchFile();
virtual bool ReadLine(char * line);
bool Goto(char * where);
void Shift(void);
Bit16u file_handle;
Bit32u location;
bool echo;
DOS_Shell * shell;
BatchFile * prev;
CommandLine * cmd;
std::string filename;
};
class AutoexecEditor;
class DOS_Shell : public Program {
private:
friend class AutoexecEditor;
std::list<std::string> l_history, l_completion;
char *completion_start;
Bit16u completion_index;
public:
DOS_Shell();
void Run(void);
void RunInternal(void); //for command /C
/* A load of subfunctions */
void ParseLine(char * line);
Bitu GetRedirection(char *s, char **ifn, char **ofn,bool * append);
void InputCommand(char * line);
void ShowPrompt();
void DoCommand(char * cmd);
bool Execute(char * name,char * args);
/* Checks if it matches a hardware-property */
bool CheckConfig(char* cmd_in,char*line);
/* Some internal used functions */
char * Which(char * name);
/* Some supported commands */
void CMD_HELP(char * args);
void CMD_CLS(char * args);
void CMD_COPY(char * args);
void CMD_DATE(char * args);
void CMD_TIME(char * args);
void CMD_DIR(char * args);
void CMD_DELETE(char * args);
void CMD_ECHO(char * args);
void CMD_EXIT(char * args);
void CMD_MKDIR(char * args);
void CMD_CHDIR(char * args);
void CMD_RMDIR(char * args);
void CMD_SET(char * args);
void CMD_IF(char * args);
void CMD_GOTO(char * args);
void CMD_TYPE(char * args);
void CMD_REM(char * args);
void CMD_RENAME(char * args);
void CMD_CALL(char * args);
void SyntaxError(void);
void CMD_PAUSE(char * args);
void CMD_SUBST(char* args);
void CMD_LOADHIGH(char* args);
void CMD_CHOICE(char * args);
void CMD_ATTRIB(char * args);
void CMD_PATH(char * args);
void CMD_SHIFT(char * args);
void CMD_VER(char * args);
/* The shell's variables */
Bit16u input_handle;
BatchFile * bf;
bool echo;
bool exit;
bool call;
};
struct SHELL_Cmd {
const char * name; /* Command name*/
Bit32u flags; /* Flags about the command */
void (DOS_Shell::*handler)(char * args); /* Handler for this command */
const char * help; /* String with command help */
};
/* Object to manage lines in the autoexec.bat The lines get removed from
* the file if the object gets destroyed. The environment is updated
* as well if the line set a a variable */
class AutoexecObject{
private:
bool installed;
std::string buf;
public:
AutoexecObject():installed(false){ };
void Install(std::string const &in);
void InstallBefore(std::string const &in);
~AutoexecObject();
private:
void CreateAutoexec(void);
};
#endif