mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-13 07:05:12 +01:00
Delete unused stuff (not needed for the C64 network)
This commit is contained in:
parent
5dbee35e1c
commit
25463e5adf
1804
Src/AcornGUI.cc
1804
Src/AcornGUI.cc
File diff suppressed because it is too large
Load Diff
357
Src/AcornGUI.h
357
Src/AcornGUI.h
@ -1,357 +0,0 @@
|
||||
/*
|
||||
* AcornGUI.h - Defines variables for the WIMP interface
|
||||
*
|
||||
* (C) 1997 Andreas Dehmel
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _ACORN_GUI_H_
|
||||
#define _ACORN_GUI_H_
|
||||
|
||||
|
||||
// Determine which paths to load from
|
||||
#ifdef FRODO_SC
|
||||
# define DEFAULT_PREFS "FrodoSC:Prefs"
|
||||
# define DEFAULT_SYSCONF "FrodoSC:SysConf"
|
||||
#else
|
||||
# ifdef FRODO_PC
|
||||
# define DEFAULT_PREFS "FrodoPC:Prefs"
|
||||
# define DEFAULT_SYSCONF "FrodoPC:SysConf"
|
||||
# else
|
||||
# define DEFAULT_PREFS "Frodo:Prefs"
|
||||
# define DEFAULT_SYSCONF "Frodo:SysConf"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// Text written in pane icons:
|
||||
#define PANE_TEXT_PAUSE "Pause"
|
||||
#define PANE_TEXT_RESUME "Cont"
|
||||
#define PANE_TEXT_ZOOM1 "1 x"
|
||||
#define PANE_TEXT_ZOOM2 "2 x"
|
||||
|
||||
|
||||
// OS units of extra space between EmuWindow and Pane
|
||||
#define EmuPaneSpace 2
|
||||
// OS units of the (volume) well's border
|
||||
#define WellBorder 12
|
||||
// Height of title bar in OS units
|
||||
#define TitleBarHeight 44
|
||||
// Maximum volume of the Sound system
|
||||
#define MaximumVolume 127
|
||||
|
||||
|
||||
|
||||
|
||||
// Message Block indices
|
||||
#define MsgB_Size 0
|
||||
#define MsgB_Sender 1
|
||||
#define MsgB_MyRef 2
|
||||
#define MsgB_YourRef 3
|
||||
#define MsgB_Action 4
|
||||
|
||||
|
||||
// Messages
|
||||
#define Message_Quit 0x00000
|
||||
#define Message_DataSave 0x00001
|
||||
#define Message_DataSaveAck 0x00002
|
||||
#define Message_DataLoad 0x00003
|
||||
#define Message_DataLoadAck 0x00004
|
||||
#define Message_DataOpen 0x00005
|
||||
#define Message_RAMFetch 0x00006
|
||||
#define Message_RAMTransmit 0x00007
|
||||
#define Message_PreQuit 0x00008
|
||||
#define Message_PaletteChange 0x00009
|
||||
#define Message_MenuWarning 0x400c0
|
||||
#define Message_ModeChange 0x400c1
|
||||
|
||||
|
||||
// Redraw Window Block
|
||||
#define RedrawB_Handle 0
|
||||
#define RedrawB_VMinX 1
|
||||
#define RedrawB_VMinY 2
|
||||
#define RedrawB_VMaxX 3
|
||||
#define RedrawB_VMaxY 4
|
||||
#define RedrawB_ScrollX 5
|
||||
#define RedrawB_ScrollY 6
|
||||
#define RedrawB_CMinX 7
|
||||
#define RedrawB_CMinY 8
|
||||
#define RedrawB_CMaxX 9
|
||||
#define RedrawB_CMaxY 10
|
||||
|
||||
|
||||
// Window block (e.g. open, getstate.... For create: subtract -1 (no handle))
|
||||
#define WindowB_Handle 0
|
||||
#define WindowB_VMinX 1
|
||||
#define WindowB_VMinY 2
|
||||
#define WindowB_VMaxX 3
|
||||
#define WindowB_VMaxY 4
|
||||
#define WindowB_ScrollX 5
|
||||
#define WindowB_ScrollY 6
|
||||
#define WindowB_Stackpos 7
|
||||
#define WindowB_WFlags 8
|
||||
#define WindowB_Colours1 9
|
||||
#define WindowB_Colours2 10
|
||||
#define WindowB_WMinX 11
|
||||
#define WindowB_WMinY 12
|
||||
#define WindowB_WMaxX 13
|
||||
#define WindowB_WMaxY 14
|
||||
#define WindowB_TFlags 15
|
||||
#define WindowB_WAFlags 16
|
||||
#define WindowB_SpriteArea 17
|
||||
#define WindowB_MinDims 18
|
||||
#define WindowB_Data 19
|
||||
#define WindowB_Icons 22
|
||||
|
||||
|
||||
// Raw icon block
|
||||
#define RawIB_MinX 0
|
||||
#define RawIB_MinY 1
|
||||
#define RawIB_MaxX 2
|
||||
#define RawIB_MaxY 3
|
||||
#define RawIB_Flags 4
|
||||
#define RawIB_Data0 5
|
||||
#define RawIB_Data1 6
|
||||
#define RawIB_Data2 7
|
||||
|
||||
|
||||
// Icon block (as in GetIconState)
|
||||
#define IconB_Handle 0
|
||||
#define IconB_Number 1
|
||||
#define IconB_MinX 2
|
||||
#define IconB_MinY 3
|
||||
#define IconB_MaxX 4
|
||||
#define IconB_MaxY 5
|
||||
#define IconB_Flags 6
|
||||
#define IconB_Data0 7
|
||||
#define IconB_Data1 8
|
||||
#define IconB_Data2 9
|
||||
|
||||
|
||||
// Mouse click block (also: get pointer info):
|
||||
#define MouseB_PosX 0
|
||||
#define MouseB_PosY 1
|
||||
#define MouseB_Buttons 2
|
||||
#define MouseB_Window 3
|
||||
#define MouseB_Icon 4
|
||||
|
||||
|
||||
// Key pressed block
|
||||
#define KeyPB_Window 0
|
||||
#define KeyPB_Icon 1
|
||||
#define KeyPB_PosX 2
|
||||
#define KeyPB_PosY 3
|
||||
#define KeyPB_CHeight 4
|
||||
#define KeyPB_Index 5
|
||||
#define KeyPB_Key 6
|
||||
|
||||
|
||||
// Drag Block
|
||||
#define DragB_Handle 0
|
||||
#define DragB_Type 1
|
||||
#define DragB_IMinX 2
|
||||
#define DragB_IMinY 3
|
||||
#define DragB_IMaxX 4
|
||||
#define DragB_IMaxY 5
|
||||
#define DragB_BBMinX 6
|
||||
#define DragB_BBMinY 7
|
||||
#define DragB_BBMaxX 8
|
||||
#define DragB_BBMaxY 9
|
||||
#define DragB_R12 10
|
||||
#define DragB_DrawCode 11
|
||||
#define DragB_RemoveCode 12
|
||||
#define DragB_MoveCode 13
|
||||
|
||||
|
||||
// Drag A Sprite Block
|
||||
#define DASB_MinX 0
|
||||
#define DASB_MinY 1
|
||||
#define DASB_MaxX 2
|
||||
#define DASB_MaxY 3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Menu definitions
|
||||
#define Menu_IBar 1
|
||||
#define Menu_Emulator 2
|
||||
|
||||
#define Menu_Height 44
|
||||
#define Menu_Flags 0x07003011
|
||||
|
||||
#define Menu_IBar_Items 5
|
||||
#define Menu_IBar_Width 256
|
||||
#define Menu_IBar_Info 0
|
||||
#define Menu_IBar_Prefs 1
|
||||
#define Menu_IBar_Config 2
|
||||
#define Menu_IBar_Sound 3
|
||||
#define Menu_IBar_Quit 4
|
||||
|
||||
#define Menu_EWind_Items 4
|
||||
#define Menu_EWind_Width 200
|
||||
#define Menu_EWind_Info 0
|
||||
#define Menu_EWind_Sound 1
|
||||
#define Menu_EWind_SaveRAM 2
|
||||
#define Menu_EWind_Snapshot 3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Icons used in window definitions:
|
||||
#define Icon_Pane_LED0 1
|
||||
#define Icon_Pane_LED1 3
|
||||
#define Icon_Pane_LED2 5
|
||||
#define Icon_Pane_LED3 7
|
||||
#define Icon_Pane_Drive0 0
|
||||
#define Icon_Pane_Drive1 2
|
||||
#define Icon_Pane_Drive2 4
|
||||
#define Icon_Pane_Drive3 6
|
||||
#define Icon_Pane_Reset 8
|
||||
#define Icon_Pane_Pause 9
|
||||
#define Icon_Pane_Speed 10
|
||||
#define Icon_Pane_Toggle 11
|
||||
|
||||
#define Icon_Prefs_Dr8DIR 6
|
||||
#define Icon_Prefs_Dr8D64 7
|
||||
#define Icon_Prefs_Dr8T64 8
|
||||
#define Icon_Prefs_Dr8Path 9
|
||||
#define Icon_Prefs_Dr9DIR 11
|
||||
#define Icon_Prefs_Dr9D64 12
|
||||
#define Icon_Prefs_Dr9T64 13
|
||||
#define Icon_Prefs_Dr9Path 14
|
||||
#define Icon_Prefs_Dr10DIR 16
|
||||
#define Icon_Prefs_Dr10D64 17
|
||||
#define Icon_Prefs_Dr10T64 18
|
||||
#define Icon_Prefs_Dr10Path 19
|
||||
#define Icon_Prefs_Dr11DIR 21
|
||||
#define Icon_Prefs_Dr11D64 22
|
||||
#define Icon_Prefs_Dr11T64 23
|
||||
#define Icon_Prefs_Dr11Path 24
|
||||
#define Icon_Prefs_Emul1541 25
|
||||
#define Icon_Prefs_MapSlash 26
|
||||
#define Icon_Prefs_SIDNone 29
|
||||
#define Icon_Prefs_SIDDigi 30
|
||||
#define Icon_Prefs_SIDCard 31
|
||||
#define Icon_Prefs_SIDFilter 32
|
||||
#define Icon_Prefs_REUNone 35
|
||||
#define Icon_Prefs_REU128 36
|
||||
#define Icon_Prefs_REU256 37
|
||||
#define Icon_Prefs_REU512 38
|
||||
#define Icon_Prefs_SkipFLeft 41
|
||||
#define Icon_Prefs_SkipFRight 42
|
||||
#define Icon_Prefs_SkipFText 43
|
||||
#define Icon_Prefs_SprOn 47
|
||||
#define Icon_Prefs_SprColl 48
|
||||
#define Icon_Prefs_Joy1On 50
|
||||
#define Icon_Prefs_Joy2On 51
|
||||
#define Icon_Prefs_JoySwap 52
|
||||
#define Icon_Prefs_LimSpeed 55
|
||||
#define Icon_Prefs_FastReset 56
|
||||
#define Icon_Prefs_CIAHack 57
|
||||
#define Icon_Prefs_CycleNorm 64
|
||||
#define Icon_Prefs_CycleBad 65
|
||||
#define Icon_Prefs_CycleCIA 66
|
||||
#define Icon_Prefs_CycleFloppy 67
|
||||
#define Icon_Prefs_Cancel 68
|
||||
#define Icon_Prefs_OK 69
|
||||
#define Icon_Prefs_PrefPath 70
|
||||
#define Icon_Prefs_Save 71
|
||||
#define Icon_Prefs_PrefSprite 72
|
||||
#define Icon_Prefs_XROMOn 75
|
||||
#define Icon_Prefs_XROMPath 76
|
||||
|
||||
#define Icon_Conf_PollAfter 3
|
||||
#define Icon_Conf_SpeedAfter 5
|
||||
#define Icon_Conf_Joy1Up 15
|
||||
#define Icon_Conf_Joy1Down 16
|
||||
#define Icon_Conf_Joy1Left 17
|
||||
#define Icon_Conf_Joy1Right 18
|
||||
#define Icon_Conf_Joy1Fire 19
|
||||
#define Icon_Conf_Joy2Up 27
|
||||
#define Icon_Conf_Joy2Down 28
|
||||
#define Icon_Conf_Joy2Left 29
|
||||
#define Icon_Conf_Joy2Right 30
|
||||
#define Icon_Conf_Joy2Fire 31
|
||||
#define Icon_Conf_OK 32
|
||||
#define Icon_Conf_Save 33
|
||||
#define Icon_Conf_ConfPath 34
|
||||
#define Icon_Conf_ConfSprite 35
|
||||
#define Icon_Conf_SoundAfter 37
|
||||
|
||||
#define Icon_Info_Name 4
|
||||
#define Icon_Info_Purpose 5
|
||||
#define Icon_Info_Author 6
|
||||
#define Icon_Info_AuthorPort 7
|
||||
#define Icon_Info_Version 8
|
||||
|
||||
#define Icon_Sound_Volume 0
|
||||
#define Icon_Sound_Notes 1
|
||||
|
||||
#define Icon_Save_Sprite 0
|
||||
#define Icon_Save_Path 1
|
||||
#define Icon_Save_OK 2
|
||||
|
||||
|
||||
|
||||
|
||||
// Drag types
|
||||
#define DRAG_PrefsSprite 1
|
||||
#define DRAG_ConfSprite 2
|
||||
#define DRAG_SaveSprite 3
|
||||
#define DRAG_VolumeWell 16
|
||||
|
||||
|
||||
|
||||
// Save types
|
||||
#define SAVE_RAM 1
|
||||
#define SAVE_Snapshot 2
|
||||
|
||||
|
||||
|
||||
|
||||
// variables
|
||||
|
||||
extern char LEDtoIcon[4];
|
||||
extern char DriveToIcon[16];
|
||||
extern char SIDtoIcon[3];
|
||||
extern char REUtoIcon[4];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Plotter structs and variables
|
||||
typedef struct {
|
||||
int x, y, dimx, dimy;
|
||||
} graph_env;
|
||||
|
||||
#define PLOTTER_ARGS const graph_env *GraphEnv, const int *Clipwindow,\
|
||||
const uint8 *Bitmap, const unsigned int *TransTab
|
||||
|
||||
// Plotters provided in Plotters.s -- declare as C-functions !
|
||||
extern "C"
|
||||
{
|
||||
extern void PlotZoom1(PLOTTER_ARGS);
|
||||
extern void PlotZoom2(PLOTTER_ARGS);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* AcornGUI_SC.cc
|
||||
*
|
||||
* The RISC OS port needs to recompile AcornGUI_SC.cc with FRODO_SC defined
|
||||
* or it won't work. Source code is identical with AcornGUI.cc
|
||||
*
|
||||
* (C) 1997 Andreas Dehmel
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "AcornGUI.cc"
|
407
Src/AmigaGUI.c
407
Src/AmigaGUI.c
@ -1,407 +0,0 @@
|
||||
/*
|
||||
* Source machine generated by GadToolsBox V2.0b
|
||||
* which is (c) Copyright 1991-1993 Jaba Development
|
||||
*
|
||||
* GUI Designed by : Christian Bauer
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <intuition/intuition.h>
|
||||
#include <intuition/classes.h>
|
||||
#include <intuition/classusr.h>
|
||||
#include <intuition/imageclass.h>
|
||||
#include <intuition/gadgetclass.h>
|
||||
#include <libraries/gadtools.h>
|
||||
#include <graphics/displayinfo.h>
|
||||
#include <graphics/gfxbase.h>
|
||||
#include <clib/exec_protos.h>
|
||||
#include <clib/intuition_protos.h>
|
||||
#include <clib/gadtools_protos.h>
|
||||
#include <clib/graphics_protos.h>
|
||||
#include <clib/utility_protos.h>
|
||||
#include <string.h>
|
||||
#include "AmigaGUI.h"
|
||||
|
||||
struct Screen *Scr = NULL;
|
||||
UBYTE *PubScreenName = NULL;
|
||||
APTR VisualInfo = NULL;
|
||||
struct Window *PrefsWnd = NULL;
|
||||
struct Gadget *PrefsGList = NULL;
|
||||
struct Menu *PrefsMenus = NULL;
|
||||
struct IntuiMessage PrefsMsg;
|
||||
UWORD PrefsZoom[4];
|
||||
struct Gadget *PrefsGadgets[31];
|
||||
UWORD PrefsLeft = 0;
|
||||
UWORD PrefsTop = 16;
|
||||
UWORD PrefsWidth = 561;
|
||||
UWORD PrefsHeight = 238;
|
||||
UBYTE *PrefsWdt = (UBYTE *)"Frodo Preferences";
|
||||
struct TextAttr *Font, Attr;
|
||||
UWORD FontX, FontY;
|
||||
UWORD OffX, OffY;
|
||||
|
||||
UBYTE *SIDType0Labels[] = {
|
||||
(UBYTE *)"None",
|
||||
(UBYTE *)"Digital (AHI)",
|
||||
(UBYTE *)"SID Card",
|
||||
NULL };
|
||||
|
||||
UBYTE *REUSize0Labels[] = {
|
||||
(UBYTE *)"None",
|
||||
(UBYTE *)"128K",
|
||||
(UBYTE *)"256K",
|
||||
(UBYTE *)"512K",
|
||||
NULL };
|
||||
|
||||
UBYTE *DriveType80Labels[] = {
|
||||
(UBYTE *)"DIR",
|
||||
(UBYTE *)"D64",
|
||||
(UBYTE *)"T64",
|
||||
NULL };
|
||||
|
||||
UBYTE *DriveType90Labels[] = {
|
||||
(UBYTE *)"DIR",
|
||||
(UBYTE *)"D64",
|
||||
(UBYTE *)"T64",
|
||||
NULL };
|
||||
|
||||
UBYTE *DriveType100Labels[] = {
|
||||
(UBYTE *)"DIR",
|
||||
(UBYTE *)"D64",
|
||||
(UBYTE *)"T64",
|
||||
NULL };
|
||||
|
||||
UBYTE *DriveType110Labels[] = {
|
||||
(UBYTE *)"DIR",
|
||||
(UBYTE *)"D64",
|
||||
(UBYTE *)"T64",
|
||||
NULL };
|
||||
|
||||
struct IntuiText PrefsIText[] = {
|
||||
2, 0, JAM1,34, 115, NULL, (UBYTE *)"Drive", NULL };
|
||||
|
||||
#define Prefs_TNUM 1
|
||||
|
||||
struct NewMenu PrefsNewMenu[] = {
|
||||
NM_TITLE, (STRPTR)"Preferences", NULL, 0, NULL, NULL,
|
||||
NM_ITEM, (STRPTR)"Open...", (STRPTR)"O", 0, 0L, (APTR)PrefsOpen,
|
||||
NM_ITEM, (STRPTR)"Save", (STRPTR)"S", 0, 0L, (APTR)PrefsSave,
|
||||
NM_ITEM, (STRPTR)"Save As...", (STRPTR)"A", 0, 0L, (APTR)PrefsSaveAs,
|
||||
NM_ITEM, (STRPTR)"Revert", (STRPTR)"R", 0, 0L, (APTR)PrefsRevert,
|
||||
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
|
||||
NM_ITEM, (STRPTR)"OK", NULL, 0, 0L, (APTR)PrefsOK,
|
||||
NM_ITEM, (STRPTR)"Cancel", NULL, 0, 0L, (APTR)PrefsCancel,
|
||||
NM_END, NULL, NULL, 0, 0L, NULL };
|
||||
|
||||
UWORD PrefsGTypes[] = {
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
INTEGER_KIND,
|
||||
INTEGER_KIND,
|
||||
INTEGER_KIND,
|
||||
INTEGER_KIND,
|
||||
INTEGER_KIND,
|
||||
CYCLE_KIND,
|
||||
CYCLE_KIND,
|
||||
STRING_KIND,
|
||||
CYCLE_KIND,
|
||||
STRING_KIND,
|
||||
CYCLE_KIND,
|
||||
STRING_KIND,
|
||||
CYCLE_KIND,
|
||||
STRING_KIND,
|
||||
CYCLE_KIND,
|
||||
CHECKBOX_KIND,
|
||||
CHECKBOX_KIND,
|
||||
BUTTON_KIND,
|
||||
BUTTON_KIND,
|
||||
BUTTON_KIND,
|
||||
BUTTON_KIND,
|
||||
BUTTON_KIND,
|
||||
BUTTON_KIND
|
||||
};
|
||||
|
||||
struct NewGadget PrefsNGad[] = {
|
||||
8, 4, 26, 11, (UBYTE *)"Sprite display", NULL, GD_SpritesOn, PLACETEXT_RIGHT, NULL, (APTR)SpritesOnClicked,
|
||||
8, 16, 26, 11, (UBYTE *)"Sprite collisions", NULL, GD_SpriteCollisions, PLACETEXT_RIGHT, NULL, (APTR)SpriteCollisionsClicked,
|
||||
8, 28, 26, 11, (UBYTE *)"Joystick connected", NULL, GD_Joystick2On, PLACETEXT_RIGHT, NULL, (APTR)Joystick2OnClicked,
|
||||
8, 40, 26, 11, (UBYTE *)"Map joystick to port 1", NULL, GD_JoystickSwap, PLACETEXT_RIGHT, NULL, (APTR)JoystickSwapClicked,
|
||||
8, 52, 26, 11, (UBYTE *)"Limit speed", NULL, GD_LimitSpeed, PLACETEXT_RIGHT, NULL, (APTR)LimitSpeedClicked,
|
||||
8, 64, 26, 11, (UBYTE *)"Fast reset", NULL, GD_FastReset, PLACETEXT_RIGHT, NULL, (APTR)FastResetClicked,
|
||||
8, 76, 26, 11, (UBYTE *)"Clear CIA ICR on write", NULL, GD_CIAIRQHack, PLACETEXT_RIGHT, NULL, (APTR)CIAIRQHackClicked,
|
||||
8, 88, 26, 11, (UBYTE *)"SID filters", NULL, GD_SIDFilters, PLACETEXT_RIGHT, NULL, (APTR)SIDFiltersClicked,
|
||||
490, 4, 65, 14, (UBYTE *)"Cycles per line (CPU)", NULL, GD_NormalCycles, PLACETEXT_LEFT, NULL, (APTR)NormalCyclesClicked,
|
||||
490, 19, 65, 14, (UBYTE *)"Cycles per Bad Line (CPU)", NULL, GD_BadLineCycles, PLACETEXT_LEFT, NULL, (APTR)BadLineCyclesClicked,
|
||||
490, 34, 65, 14, (UBYTE *)"Cycles per line (CIA)", NULL, GD_CIACycles, PLACETEXT_LEFT, NULL, (APTR)CIACyclesClicked,
|
||||
490, 49, 65, 14, (UBYTE *)"Cycles per line (1541)", NULL, GD_FloppyCycles, PLACETEXT_LEFT, NULL, (APTR)FloppyCyclesClicked,
|
||||
490, 64, 65, 14, (UBYTE *)"Draw every n-th frame", NULL, GD_SkipFrames, PLACETEXT_LEFT, NULL, (APTR)SkipFramesClicked,
|
||||
426, 79, 129, 14, (UBYTE *)"SID emulation type", NULL, GD_SIDType, PLACETEXT_LEFT, NULL, (APTR)SIDTypeClicked,
|
||||
426, 94, 129, 14, (UBYTE *)"REU size", NULL, GD_REUSize, PLACETEXT_LEFT, NULL, (APTR)REUSizeClicked,
|
||||
47, 123, 401, 14, (UBYTE *)"8", NULL, GD_DrivePath8, PLACETEXT_LEFT, NULL, (APTR)DrivePath8Clicked,
|
||||
470, 123, 65, 14, NULL, NULL, GD_DriveType8, 0, NULL, (APTR)DriveType8Clicked,
|
||||
47, 138, 401, 14, (UBYTE *)"9", NULL, GD_DrivePath9, PLACETEXT_LEFT, NULL, (APTR)DrivePath9Clicked,
|
||||
470, 138, 65, 14, NULL, NULL, GD_DriveType9, 0, NULL, (APTR)DriveType9Clicked,
|
||||
47, 153, 401, 14, (UBYTE *)"10", NULL, GD_DrivePath10, PLACETEXT_LEFT, NULL, (APTR)DrivePath10Clicked,
|
||||
470, 153, 65, 14, NULL, NULL, GD_DriveType10, 0, NULL, (APTR)DriveType10Clicked,
|
||||
47, 168, 401, 14, (UBYTE *)"11", NULL, GD_DrivePath11, PLACETEXT_LEFT, NULL, (APTR)DrivePath11Clicked,
|
||||
470, 168, 65, 14, NULL, NULL, GD_DriveType11, 0, NULL, (APTR)DriveType11Clicked,
|
||||
20, 186, 26, 11, (UBYTE *)"Map '/'<->'\' in filenames", NULL, GD_MapSlash, PLACETEXT_RIGHT, NULL, (APTR)MapSlashClicked,
|
||||
20, 198, 26, 11, (UBYTE *)"Enable 1541 processor emulation", NULL, GD_Emul1541Proc, PLACETEXT_RIGHT, NULL, (APTR)Emul1541ProcClicked,
|
||||
61, 218, 81, 16, (UBYTE *)"_OK", NULL, GD_OK, PLACETEXT_IN, NULL, (APTR)OKClicked,
|
||||
416, 218, 81, 16, (UBYTE *)"_Cancel", NULL, GD_Cancel, PLACETEXT_IN, NULL, (APTR)CancelClicked,
|
||||
448, 123, 20, 14, (UBYTE *)"·", NULL, GD_GetDrive8, PLACETEXT_IN, NULL, (APTR)GetDrive8Clicked,
|
||||
448, 138, 20, 14, (UBYTE *)"·", NULL, GD_GetDrive9, PLACETEXT_IN, NULL, (APTR)GetDrive9Clicked,
|
||||
448, 153, 20, 14, (UBYTE *)"·", NULL, GD_GetDrive10, PLACETEXT_IN, NULL, (APTR)GetDrive10Clicked,
|
||||
448, 168, 20, 14, (UBYTE *)"·", NULL, GD_GetDrive11, PLACETEXT_IN, NULL, (APTR)GetDrive11Clicked
|
||||
};
|
||||
|
||||
ULONG PrefsGTags[] = {
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGRIGHT), (TAG_DONE),
|
||||
(GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGRIGHT), (TAG_DONE),
|
||||
(GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGRIGHT), (TAG_DONE),
|
||||
(GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGRIGHT), (TAG_DONE),
|
||||
(GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGRIGHT), (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&SIDType0Labels[ 0 ], (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&REUSize0Labels[ 0 ], (TAG_DONE),
|
||||
(GTST_MaxChars), 256, (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&DriveType80Labels[ 0 ], (TAG_DONE),
|
||||
(GTST_MaxChars), 256, (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&DriveType90Labels[ 0 ], (TAG_DONE),
|
||||
(GTST_MaxChars), 256, (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&DriveType100Labels[ 0 ], (TAG_DONE),
|
||||
(GTST_MaxChars), 256, (TAG_DONE),
|
||||
(GTCY_Labels), (ULONG)&DriveType110Labels[ 0 ], (TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(GT_Underscore), '_', (TAG_DONE),
|
||||
(GT_Underscore), '_', (TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE),
|
||||
(TAG_DONE)
|
||||
};
|
||||
|
||||
static UWORD ComputeX( UWORD value )
|
||||
{
|
||||
return(( UWORD )((( FontX * value ) + 4 ) / 8 ));
|
||||
}
|
||||
|
||||
static UWORD ComputeY( UWORD value )
|
||||
{
|
||||
return(( UWORD )((( FontY * value ) + 4 ) / 8 ));
|
||||
}
|
||||
|
||||
static void ComputeFont( UWORD width, UWORD height )
|
||||
{
|
||||
Font = &Attr;
|
||||
Font->ta_Name = (STRPTR)Scr->RastPort.Font->tf_Message.mn_Node.ln_Name;
|
||||
Font->ta_YSize = FontY = Scr->RastPort.Font->tf_YSize;
|
||||
FontX = Scr->RastPort.Font->tf_XSize;
|
||||
|
||||
OffX = Scr->WBorLeft;
|
||||
OffY = Scr->RastPort.TxHeight + Scr->WBorTop + 1;
|
||||
|
||||
if ( width && height ) {
|
||||
if (( ComputeX( width ) + OffX + Scr->WBorRight ) > Scr->Width )
|
||||
goto UseTopaz;
|
||||
if (( ComputeY( height ) + OffY + Scr->WBorBottom ) > Scr->Height )
|
||||
goto UseTopaz;
|
||||
}
|
||||
return;
|
||||
|
||||
UseTopaz:
|
||||
Font->ta_Name = (STRPTR)"topaz.font";
|
||||
FontX = FontY = Font->ta_YSize = 8;
|
||||
}
|
||||
|
||||
int SetupScreen( void )
|
||||
{
|
||||
if ( ! ( Scr = LockPubScreen( PubScreenName )))
|
||||
return( 1L );
|
||||
|
||||
ComputeFont( 0, 0 );
|
||||
|
||||
if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
|
||||
return( 2L );
|
||||
|
||||
return( 0L );
|
||||
}
|
||||
|
||||
void CloseDownScreen( void )
|
||||
{
|
||||
if ( VisualInfo ) {
|
||||
FreeVisualInfo( VisualInfo );
|
||||
VisualInfo = NULL;
|
||||
}
|
||||
|
||||
if ( Scr ) {
|
||||
UnlockPubScreen( NULL, Scr );
|
||||
Scr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void PrefsRender( void )
|
||||
{
|
||||
struct IntuiText it;
|
||||
UWORD cnt;
|
||||
|
||||
ComputeFont( PrefsWidth, PrefsHeight );
|
||||
|
||||
|
||||
for ( cnt = 0; cnt < Prefs_TNUM; cnt++ ) {
|
||||
CopyMem(( char * )&PrefsIText[ cnt ], ( char * )&it, (long)sizeof( struct IntuiText ));
|
||||
it.ITextFont = Font;
|
||||
it.LeftEdge = OffX + ComputeX( it.LeftEdge ) - ( IntuiTextLength( &it ) >> 1 );
|
||||
it.TopEdge = OffY + ComputeY( it.TopEdge ) - ( Font->ta_YSize >> 1 );
|
||||
PrintIText( PrefsWnd->RPort, &it, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
int HandlePrefsIDCMP( void )
|
||||
{
|
||||
struct IntuiMessage *m;
|
||||
struct MenuItem *n;
|
||||
int (*func)();
|
||||
BOOL running = TRUE;
|
||||
|
||||
while( m = GT_GetIMsg( PrefsWnd->UserPort )) {
|
||||
|
||||
CopyMem(( char * )m, ( char * )&PrefsMsg, (long)sizeof( struct IntuiMessage ));
|
||||
|
||||
GT_ReplyIMsg( m );
|
||||
|
||||
switch ( PrefsMsg.Class ) {
|
||||
|
||||
case IDCMP_REFRESHWINDOW:
|
||||
GT_BeginRefresh( PrefsWnd );
|
||||
PrefsRender();
|
||||
GT_EndRefresh( PrefsWnd, TRUE );
|
||||
break;
|
||||
|
||||
case IDCMP_VANILLAKEY:
|
||||
running = PrefsVanillaKey();
|
||||
break;
|
||||
|
||||
case IDCMP_GADGETUP:
|
||||
func = ( void * )(( struct Gadget * )PrefsMsg.IAddress )->UserData;
|
||||
running = func();
|
||||
break;
|
||||
|
||||
case IDCMP_MENUPICK:
|
||||
while( PrefsMsg.Code != MENUNULL ) {
|
||||
n = ItemAddress( PrefsMenus, PrefsMsg.Code );
|
||||
func = (void *)(GTMENUITEM_USERDATA( n ));
|
||||
running = func();
|
||||
PrefsMsg.Code = n->NextSelect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return( running );
|
||||
}
|
||||
|
||||
int OpenPrefsWindow( void )
|
||||
{
|
||||
struct NewGadget ng;
|
||||
struct Gadget *g;
|
||||
UWORD lc, tc;
|
||||
UWORD wleft = PrefsLeft, wtop = PrefsTop, ww, wh;
|
||||
|
||||
ComputeFont( PrefsWidth, PrefsHeight );
|
||||
|
||||
ww = ComputeX( PrefsWidth );
|
||||
wh = ComputeY( PrefsHeight );
|
||||
|
||||
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
|
||||
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
|
||||
|
||||
if ( ! ( g = CreateContext( &PrefsGList )))
|
||||
return( 1L );
|
||||
|
||||
for( lc = 0, tc = 0; lc < Prefs_CNT; lc++ ) {
|
||||
|
||||
CopyMem((char * )&PrefsNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
|
||||
|
||||
ng.ng_VisualInfo = VisualInfo;
|
||||
ng.ng_TextAttr = Font;
|
||||
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
|
||||
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
|
||||
ng.ng_Width = ComputeX( ng.ng_Width );
|
||||
ng.ng_Height = ComputeY( ng.ng_Height);
|
||||
|
||||
PrefsGadgets[ lc ] = g = CreateGadgetA((ULONG)PrefsGTypes[ lc ], g, &ng, ( struct TagItem * )&PrefsGTags[ tc ] );
|
||||
|
||||
while( PrefsGTags[ tc ] ) tc += 2;
|
||||
tc++;
|
||||
|
||||
if ( NOT g )
|
||||
return( 2L );
|
||||
}
|
||||
|
||||
if ( ! ( PrefsMenus = CreateMenus( PrefsNewMenu, GTMN_FrontPen, 0L, TAG_DONE )))
|
||||
return( 3L );
|
||||
|
||||
LayoutMenus( PrefsMenus, VisualInfo, TAG_DONE );
|
||||
|
||||
PrefsZoom[0] = PrefsZoom[1] = 0;
|
||||
if ( PrefsWdt )
|
||||
PrefsZoom[2] = TextLength( &Scr->RastPort, (UBYTE *)PrefsWdt, strlen((char *)PrefsWdt )) + 80;
|
||||
else
|
||||
PrefsZoom[2] = 80L;
|
||||
PrefsZoom[3] = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
|
||||
|
||||
if ( ! ( PrefsWnd = OpenWindowTags( NULL,
|
||||
WA_Left, wleft,
|
||||
WA_Top, wtop,
|
||||
WA_Width, ww + OffX + Scr->WBorRight,
|
||||
WA_Height, wh + OffY + Scr->WBorBottom,
|
||||
WA_IDCMP, CHECKBOXIDCMP|INTEGERIDCMP|CYCLEIDCMP|STRINGIDCMP|BUTTONIDCMP|IDCMP_MENUPICK|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
|
||||
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SMART_REFRESH|WFLG_SIMPLE_REFRESH|WFLG_ACTIVATE,
|
||||
WA_Gadgets, PrefsGList,
|
||||
WA_Title, PrefsWdt,
|
||||
WA_ScreenTitle, "Frodo C64 Emulator",
|
||||
WA_PubScreen, Scr,
|
||||
WA_Zoom, PrefsZoom,
|
||||
TAG_DONE )))
|
||||
return( 4L );
|
||||
|
||||
SetMenuStrip( PrefsWnd, PrefsMenus );
|
||||
GT_RefreshWindow( PrefsWnd, NULL );
|
||||
|
||||
PrefsRender();
|
||||
|
||||
return( 0L );
|
||||
}
|
||||
|
||||
void ClosePrefsWindow( void )
|
||||
{
|
||||
if ( PrefsMenus ) {
|
||||
ClearMenuStrip( PrefsWnd );
|
||||
FreeMenus( PrefsMenus );
|
||||
PrefsMenus = NULL; }
|
||||
|
||||
if ( PrefsWnd ) {
|
||||
CloseWindow( PrefsWnd );
|
||||
PrefsWnd = NULL;
|
||||
}
|
||||
|
||||
if ( PrefsGList ) {
|
||||
FreeGadgets( PrefsGList );
|
||||
PrefsGList = NULL;
|
||||
}
|
||||
}
|
||||
|
BIN
Src/AmigaGUI.gui
BIN
Src/AmigaGUI.gui
Binary file not shown.
153
Src/AmigaGUI.h
153
Src/AmigaGUI.h
@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Source machine generated by GadToolsBox V2.0b
|
||||
* which is (c) Copyright 1991-1993 Jaba Development
|
||||
*
|
||||
* GUI Designed by : Christian Bauer
|
||||
*/
|
||||
|
||||
#define GetString( g ) ((( struct StringInfo * )g->SpecialInfo )->Buffer )
|
||||
#define GetNumber( g ) ((( struct StringInfo * )g->SpecialInfo )->LongInt )
|
||||
|
||||
#define GD_SpritesOn 0
|
||||
#define GD_SpriteCollisions 1
|
||||
#define GD_Joystick2On 2
|
||||
#define GD_JoystickSwap 3
|
||||
#define GD_LimitSpeed 4
|
||||
#define GD_FastReset 5
|
||||
#define GD_CIAIRQHack 6
|
||||
#define GD_SIDFilters 7
|
||||
#define GD_NormalCycles 8
|
||||
#define GD_BadLineCycles 9
|
||||
#define GD_CIACycles 10
|
||||
#define GD_FloppyCycles 11
|
||||
#define GD_SkipFrames 12
|
||||
#define GD_SIDType 13
|
||||
#define GD_REUSize 14
|
||||
#define GD_DrivePath8 15
|
||||
#define GD_DriveType8 16
|
||||
#define GD_DrivePath9 17
|
||||
#define GD_DriveType9 18
|
||||
#define GD_DrivePath10 19
|
||||
#define GD_DriveType10 20
|
||||
#define GD_DrivePath11 21
|
||||
#define GD_DriveType11 22
|
||||
#define GD_MapSlash 23
|
||||
#define GD_Emul1541Proc 24
|
||||
#define GD_OK 25
|
||||
#define GD_Cancel 26
|
||||
#define GD_GetDrive8 27
|
||||
#define GD_GetDrive9 28
|
||||
#define GD_GetDrive10 29
|
||||
#define GD_GetDrive11 30
|
||||
|
||||
#define GDX_SpritesOn 0
|
||||
#define GDX_SpriteCollisions 1
|
||||
#define GDX_Joystick2On 2
|
||||
#define GDX_JoystickSwap 3
|
||||
#define GDX_LimitSpeed 4
|
||||
#define GDX_FastReset 5
|
||||
#define GDX_CIAIRQHack 6
|
||||
#define GDX_SIDFilters 7
|
||||
#define GDX_NormalCycles 8
|
||||
#define GDX_BadLineCycles 9
|
||||
#define GDX_CIACycles 10
|
||||
#define GDX_FloppyCycles 11
|
||||
#define GDX_SkipFrames 12
|
||||
#define GDX_SIDType 13
|
||||
#define GDX_REUSize 14
|
||||
#define GDX_DrivePath8 15
|
||||
#define GDX_DriveType8 16
|
||||
#define GDX_DrivePath9 17
|
||||
#define GDX_DriveType9 18
|
||||
#define GDX_DrivePath10 19
|
||||
#define GDX_DriveType10 20
|
||||
#define GDX_DrivePath11 21
|
||||
#define GDX_DriveType11 22
|
||||
#define GDX_MapSlash 23
|
||||
#define GDX_Emul1541Proc 24
|
||||
#define GDX_OK 25
|
||||
#define GDX_Cancel 26
|
||||
#define GDX_GetDrive8 27
|
||||
#define GDX_GetDrive9 28
|
||||
#define GDX_GetDrive10 29
|
||||
#define GDX_GetDrive11 30
|
||||
|
||||
#define Prefs_CNT 31
|
||||
|
||||
extern struct IntuitionBase *IntuitionBase;
|
||||
extern struct Library *GadToolsBase;
|
||||
|
||||
extern struct Screen *Scr;
|
||||
extern UBYTE *PubScreenName;
|
||||
extern APTR VisualInfo;
|
||||
extern struct Window *PrefsWnd;
|
||||
extern struct Gadget *PrefsGList;
|
||||
extern struct Menu *PrefsMenus;
|
||||
extern struct IntuiMessage PrefsMsg;
|
||||
extern UWORD PrefsZoom[4];
|
||||
extern struct Gadget *PrefsGadgets[31];
|
||||
extern UWORD PrefsLeft;
|
||||
extern UWORD PrefsTop;
|
||||
extern UWORD PrefsWidth;
|
||||
extern UWORD PrefsHeight;
|
||||
extern UBYTE *PrefsWdt;
|
||||
extern struct TextAttr *Font, Attr;
|
||||
extern UWORD FontX, FontY;
|
||||
extern UWORD OffX, OffY;
|
||||
extern UBYTE *SIDType0Labels[];
|
||||
extern UBYTE *REUSize0Labels[];
|
||||
extern UBYTE *DriveType80Labels[];
|
||||
extern UBYTE *DriveType90Labels[];
|
||||
extern UBYTE *DriveType100Labels[];
|
||||
extern UBYTE *DriveType110Labels[];
|
||||
extern struct IntuiText PrefsIText[];
|
||||
extern struct NewMenu PrefsNewMenu[];
|
||||
extern UWORD PrefsGTypes[];
|
||||
extern struct NewGadget PrefsNGad[];
|
||||
extern ULONG PrefsGTags[];
|
||||
|
||||
extern int SpritesOnClicked( void );
|
||||
extern int SpriteCollisionsClicked( void );
|
||||
extern int Joystick2OnClicked( void );
|
||||
extern int JoystickSwapClicked( void );
|
||||
extern int LimitSpeedClicked( void );
|
||||
extern int FastResetClicked( void );
|
||||
extern int CIAIRQHackClicked( void );
|
||||
extern int SIDFiltersClicked( void );
|
||||
extern int NormalCyclesClicked( void );
|
||||
extern int BadLineCyclesClicked( void );
|
||||
extern int CIACyclesClicked( void );
|
||||
extern int FloppyCyclesClicked( void );
|
||||
extern int SkipFramesClicked( void );
|
||||
extern int SIDTypeClicked( void );
|
||||
extern int REUSizeClicked( void );
|
||||
extern int DrivePath8Clicked( void );
|
||||
extern int DriveType8Clicked( void );
|
||||
extern int DrivePath9Clicked( void );
|
||||
extern int DriveType9Clicked( void );
|
||||
extern int DrivePath10Clicked( void );
|
||||
extern int DriveType10Clicked( void );
|
||||
extern int DrivePath11Clicked( void );
|
||||
extern int DriveType11Clicked( void );
|
||||
extern int MapSlashClicked( void );
|
||||
extern int Emul1541ProcClicked( void );
|
||||
extern int OKClicked( void );
|
||||
extern int CancelClicked( void );
|
||||
extern int GetDrive8Clicked( void );
|
||||
extern int GetDrive9Clicked( void );
|
||||
extern int GetDrive10Clicked( void );
|
||||
extern int GetDrive11Clicked( void );
|
||||
extern int PrefsOpen( void );
|
||||
extern int PrefsSave( void );
|
||||
extern int PrefsSaveAs( void );
|
||||
extern int PrefsRevert( void );
|
||||
extern int PrefsOK( void );
|
||||
extern int PrefsCancel( void );
|
||||
|
||||
extern int SetupScreen( void );
|
||||
extern void CloseDownScreen( void );
|
||||
extern void PrefsRender( void );
|
||||
extern int HandlePrefsIDCMP( void );
|
||||
extern int PrefsVanillaKey();
|
||||
extern int OpenPrefsWindow( void );
|
||||
extern void ClosePrefsWindow( void );
|
421
Src/C64_Acorn.h
421
Src/C64_Acorn.h
@ -1,421 +0,0 @@
|
||||
/*
|
||||
* C64_Acorn.h - Put the pieces together, RISC OS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Prefs.h"
|
||||
#include "ROlib.h"
|
||||
#include "AcornGUI.h"
|
||||
|
||||
|
||||
void C64::LoadSystemConfig(const char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(filename, "r")) != NULL)
|
||||
{
|
||||
int i;
|
||||
Joy_Keys *jk;
|
||||
int args[10];
|
||||
char line[256];
|
||||
|
||||
while (fgets(line, 255, fp) != 0)
|
||||
{
|
||||
char *b = line;
|
||||
register char c;
|
||||
|
||||
do {c = *b++;} while (c > 32);
|
||||
if (c == 32) // keyword mustn't contain spaces
|
||||
{
|
||||
*(b-1) = '\0';
|
||||
do {c = *b++;} while ((c >= 32) && (c != '='));
|
||||
if (c == '=') // read in keyword's arguments
|
||||
{
|
||||
int i=0;
|
||||
|
||||
while ((*b != '\0') && (i < 10))
|
||||
{
|
||||
args[i++] = strtol(b, &b, 10);
|
||||
}
|
||||
if (strcmp(line, "PollAfter") == 0) {PollAfter = args[0];}
|
||||
else if (strcmp(line, "SpeedAfter") == 0) {SpeedAfter = args[0];}
|
||||
else if (strcmp(line, "PollSoundAfter") == 0) {PollSoundAfter = args[0];}
|
||||
else if (strcmp(line, "JoystickKeys1") == 0)
|
||||
{
|
||||
jk = &(TheDisplay->JoystickKeys[0]);
|
||||
jk->up = args[0]; jk->down = args[1]; jk->left = args[2]; jk->right = args[3];
|
||||
jk->fire = args[4];
|
||||
}
|
||||
else if (strcmp(line, "JoystickKeys2") == 0)
|
||||
{
|
||||
jk = &(TheDisplay->JoystickKeys[1]);
|
||||
jk->up = args[0]; jk->down = args[1]; jk->left = args[2]; jk->right = args[3];
|
||||
jk->fire = args[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
_kernel_oserror err;
|
||||
|
||||
err.errnum = 0;
|
||||
sprintf(err.errmess,"Bad keyword <%s> in system configure file!",line);
|
||||
Wimp_ReportError(&err,1,TASKNAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C64::SaveSystemConfig(const char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(filename, "w")) != NULL)
|
||||
{
|
||||
int i;
|
||||
Joy_Keys *jk;
|
||||
|
||||
fprintf(fp,"PollAfter = %d\n", PollAfter);
|
||||
fprintf(fp,"SpeedAfter = %d\n", SpeedAfter);
|
||||
fprintf(fp,"PollSoundAfter = %d\n", PollSoundAfter);
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
jk = &(TheDisplay->JoystickKeys[i]);
|
||||
fprintf(fp,"JoystickKeys%d",i+1);
|
||||
fprintf(fp," = %d %d %d %d %d\n", jk->up, jk->down, jk->left, jk->right, jk->fire);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C64::ReadTimings(int *poll_after, int *speed_after, int *sound_after)
|
||||
{
|
||||
*poll_after = PollAfter; *speed_after = SpeedAfter; *sound_after = PollSoundAfter;
|
||||
}
|
||||
|
||||
|
||||
void C64::WriteTimings(int poll_after, int speed_after, int sound_after)
|
||||
{
|
||||
PollAfter = poll_after; SpeedAfter = speed_after; PollSoundAfter = sound_after;
|
||||
}
|
||||
|
||||
|
||||
void C64::RequestSnapshot(void)
|
||||
{
|
||||
// Snapshots are only possible if the emulation progresses to the next vsync
|
||||
if (have_a_break) Resume();
|
||||
make_a_snapshot = true;
|
||||
}
|
||||
|
||||
|
||||
void C64::c64_ctor1(void)
|
||||
{
|
||||
TheWIMP = new WIMP(this);
|
||||
PollAfter = 20; // poll every 20 centiseconds
|
||||
SpeedAfter = 200; // update speedometer every 2 seconds
|
||||
PollSoundAfter = 50; // poll DigitalRenderer every 50 lines
|
||||
HostVolume = Sound_Volume(0);
|
||||
// Just a precaution
|
||||
if (HostVolume < 0) {HostVolume = 0;}
|
||||
if (HostVolume > MaximumVolume) {HostVolume = MaximumVolume;}
|
||||
Poll = false;
|
||||
make_a_snapshot = false;
|
||||
}
|
||||
|
||||
|
||||
void C64::c64_ctor2(void)
|
||||
{
|
||||
LoadSystemConfig(DEFAULT_SYSCONF);
|
||||
// was started from multitasking so pretend ScrollLock OFF no matter what
|
||||
laststate = (ReadKeyboardStatus() & ~2); SingleTasking = false;
|
||||
lastptr = 1;
|
||||
}
|
||||
|
||||
|
||||
void C64::c64_dtor(void)
|
||||
{
|
||||
delete TheWIMP;
|
||||
}
|
||||
|
||||
|
||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
||||
{
|
||||
// Check if the Joystick module is loaded. If not then write an illegal value to
|
||||
// the joystick state.
|
||||
if (Joystick_Read(0) == -2) {joystate[0] = 0;} else {joystate[0] = 0xff;}
|
||||
if (Joystick_Read(1) == -2) {joystate[1] = 0;} else {joystate[1] = 0xff;}
|
||||
}
|
||||
|
||||
|
||||
uint8 C64::poll_joystick(int port)
|
||||
{
|
||||
register int state;
|
||||
uint8 joy;
|
||||
|
||||
if ((state = Joystick_Read(port)) != -2) // module present
|
||||
{
|
||||
if (state == -1) {joy = joystate[port];} // use old value
|
||||
else
|
||||
{
|
||||
joy = 0xff;
|
||||
if ((state & (JoyButton1 + JoyButton2)) != 0) {joy &= 0xef;} // fire
|
||||
if ((state & 0x80) == 0) // positive direction #1
|
||||
{
|
||||
if ((state & 0xff) >= JoyDir_Thresh) {joy &= 0xfe;} // up
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((256 - (state & 0xff)) >= JoyDir_Thresh) {joy &= 0xfd;} // down
|
||||
}
|
||||
if ((state & 0x8000) == 0) // positive direction #2
|
||||
{
|
||||
if ((state & 0xff00) >= JoyDir_Thresh<<8) {joy &= 0xf7;} // right
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((0x10000 - (state & 0xff00)) >= JoyDir_Thresh<<8) {joy &= 0xfb;} // left
|
||||
}
|
||||
}
|
||||
joystate[port] = joy; return(joy);
|
||||
}
|
||||
else
|
||||
{
|
||||
joystate[port] = 0; return(0xff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C64::VBlank(bool draw_frame)
|
||||
{
|
||||
int Now, KeyState;
|
||||
bool InputFocus;
|
||||
|
||||
// Poll keyboard if the window has the input focus.
|
||||
InputFocus = TheWIMP->EmuWindow->HaveInput();
|
||||
if (InputFocus)
|
||||
{
|
||||
TheDisplay->PollKeyboard(TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey, &joykey2);
|
||||
}
|
||||
|
||||
// Poll Joysticks
|
||||
TheCIA1->Joystick1 = (ThePrefs.Joystick1On) ? poll_joystick(0) : 0xff;
|
||||
TheCIA1->Joystick2 = (ThePrefs.Joystick2On) ? poll_joystick(1) : 0xff;
|
||||
|
||||
// Swap joysticks?
|
||||
if (ThePrefs.JoystickSwap)
|
||||
{
|
||||
register uint8 h;
|
||||
|
||||
h = TheCIA1->Joystick1; TheCIA1->Joystick1 = TheCIA1->Joystick2; TheCIA1->Joystick2 = h;
|
||||
}
|
||||
|
||||
// Read keyboard state directly since we'll also need ScrollLock later!
|
||||
KeyState = ReadKeyboardStatus();
|
||||
if (InputFocus)
|
||||
{
|
||||
// Keyboard emulates which joystick? (NumLock ==> Port 2, else Port 1)
|
||||
if ((KeyState & 4) == 0)
|
||||
{
|
||||
TheCIA1->Joystick2 &= joykey;
|
||||
}
|
||||
else // joykey2 only mapped if numLOCK is off.
|
||||
{
|
||||
TheCIA1->Joystick1 &= joykey; TheCIA1->Joystick2 &= joykey2;
|
||||
}
|
||||
}
|
||||
|
||||
if (draw_frame)
|
||||
{
|
||||
TheDisplay->Update();
|
||||
}
|
||||
|
||||
// Make snapshot?
|
||||
if (make_a_snapshot)
|
||||
{
|
||||
SaveSnapshot((TheWIMP->SnapFile)+44);
|
||||
make_a_snapshot = false;
|
||||
}
|
||||
|
||||
Now = OS_ReadMonotonicTime();
|
||||
|
||||
// Limit speed? (hahaha.... ah well...)
|
||||
if (ThePrefs.LimitSpeed)
|
||||
{
|
||||
int Now;
|
||||
|
||||
while ((Now - LastFrame) < 2) // 2cs per frame = 50fps (original speed)
|
||||
{
|
||||
Now = OS_ReadMonotonicTime();
|
||||
}
|
||||
LastFrame = Now;
|
||||
}
|
||||
FramesSince++;
|
||||
|
||||
// Update speedometer (update, not force redraw!)?
|
||||
if ((Now - LastSpeed) >= SpeedAfter)
|
||||
{
|
||||
char b[16];
|
||||
|
||||
if ((Now - LastSpeed) <= 0) {Now = LastSpeed+1;}
|
||||
// Speed: 100% equals 50fps (round result)
|
||||
sprintf(b,"%d%%\0",((400*FramesSince)/(Now - LastSpeed) + 1) >> 1);
|
||||
TheWIMP->EmuPane->WriteIconTextU(Icon_Pane_Speed,b);
|
||||
LastSpeed = Now; FramesSince = 0;
|
||||
}
|
||||
|
||||
if (InputFocus)
|
||||
{
|
||||
// Scroll lock state changed?
|
||||
if (((KeyState ^ laststate) & 2) != 0)
|
||||
{
|
||||
// change to single tasking: turn off mouse, else restore previous pointer
|
||||
if ((KeyState & 2) != 0) {lastptr = SetMousePointer(0); SingleTasking = true;}
|
||||
else {SetMousePointer(lastptr); OS_FlushBuffer(9); SingleTasking = false;}
|
||||
}
|
||||
if ((KeyState & 2) != 0) {lastptr = SetMousePointer(0);}
|
||||
else {SetMousePointer(lastptr); OS_FlushBuffer(9);}
|
||||
}
|
||||
|
||||
// Poll? ScrollLock forces single tasking, i.e. overrides timings.
|
||||
if (!SingleTasking)
|
||||
{
|
||||
if ((Now - LastPoll) >= PollAfter)
|
||||
{
|
||||
Poll = true;
|
||||
}
|
||||
}
|
||||
laststate = KeyState;
|
||||
}
|
||||
|
||||
|
||||
void C64::Run(void)
|
||||
{
|
||||
// Resetting chips
|
||||
TheCPU->Reset();
|
||||
TheSID->Reset();
|
||||
TheCIA1->Reset();
|
||||
TheCIA2->Reset();
|
||||
TheCPU1541->Reset();
|
||||
|
||||
// Patch kernel IEC routines (copied from C64_Amiga.i
|
||||
orig_kernal_1d84 = Kernal[0x1d84];
|
||||
orig_kernal_1d85 = Kernal[0x1d85];
|
||||
PatchKernal(ThePrefs.FastReset, ThePrefs.Emul1541Proc);
|
||||
|
||||
// Start the emulation
|
||||
thread_running = true; quit_thyself = false; have_a_break = false;
|
||||
thread_func();
|
||||
}
|
||||
|
||||
|
||||
void C64::Quit(void)
|
||||
{
|
||||
if (thread_running)
|
||||
{
|
||||
quit_thyself = true; thread_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C64::Pause(void)
|
||||
{
|
||||
have_a_break = true; TheSID->PauseSound();
|
||||
}
|
||||
|
||||
|
||||
void C64::Resume(void)
|
||||
{
|
||||
have_a_break = false; TheSID->ResumeSound();
|
||||
}
|
||||
|
||||
|
||||
void C64::thread_func(void)
|
||||
{
|
||||
LastPoll = LastFrame = LastSpeed = OS_ReadMonotonicTime(); FramesSince = 0;
|
||||
|
||||
while (!quit_thyself)
|
||||
{
|
||||
#ifdef FRODO_SC
|
||||
if (TheVIC->EmulateCycle()) {TheSID->EmulateLine();}
|
||||
TheCIA1->EmulateCycle();
|
||||
TheCIA2->EmulateCycle();
|
||||
TheCPU->EmulateCycle();
|
||||
|
||||
if (ThePrefs.Emul1541Proc)
|
||||
{
|
||||
TheCPU1541->CountVIATimers(1);
|
||||
if (!TheCPU1541->Idle) {TheCPU1541->EmulateCycle();}
|
||||
}
|
||||
CycleCounter++;
|
||||
|
||||
#else
|
||||
// Emulate each device one rasterline. Order is important!
|
||||
int cycles = TheVIC->EmulateLine();
|
||||
TheSID->EmulateLine();
|
||||
#if !PRECISE_CIA_CYCLES
|
||||
TheCIA1->EmulateLine(ThePrefs.CIACycles);
|
||||
TheCIA2->EmulateLine(ThePrefs.CIACycles);
|
||||
#endif
|
||||
|
||||
if (ThePrefs.Emul1541Proc)
|
||||
{
|
||||
int cycles_1541 = ThePrefs.FloppyCycles;
|
||||
TheCPU1541->CountVIATimers(cycles_1541);
|
||||
if (!TheCPU1541->Idle)
|
||||
{
|
||||
while ((cycles >= 0) || (cycles_1541 >= 0))
|
||||
{
|
||||
if (cycles > cycles_1541) {cycles -= TheCPU->EmulateLine(1);}
|
||||
else {cycles_1541 -= TheCPU1541->EmulateLine(1);}
|
||||
}
|
||||
}
|
||||
else {TheCPU->EmulateLine(cycles);}
|
||||
}
|
||||
else
|
||||
{
|
||||
TheCPU->EmulateLine(cycles);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Single-tasking: busy-wait 'til unpause
|
||||
while (SingleTasking && have_a_break)
|
||||
{
|
||||
int KeyState;
|
||||
|
||||
TheDisplay->CheckForUnpause(true); // unpause?
|
||||
KeyState = ReadKeyboardStatus();
|
||||
if ((KeyState & 2) == 0) // leave single tasking?
|
||||
{
|
||||
SetMousePointer(lastptr); OS_FlushBuffer(9); SingleTasking = false;
|
||||
}
|
||||
laststate = KeyState;
|
||||
}
|
||||
if (!SingleTasking)
|
||||
{
|
||||
// The system-specific part of this function
|
||||
if (Poll || have_a_break)
|
||||
{
|
||||
TheWIMP->Poll(have_a_break);
|
||||
LastPoll = LastFrame = OS_ReadMonotonicTime(); Poll = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
407
Src/C64_Amiga.h
407
Src/C64_Amiga.h
@ -1,407 +0,0 @@
|
||||
/*
|
||||
* C64_Amiga.h - Put the pieces together, Amiga specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <proto/timer.h>
|
||||
|
||||
|
||||
// Library bases
|
||||
struct Device *TimerBase;
|
||||
|
||||
|
||||
/*
|
||||
* Constructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_ctor1(void)
|
||||
{
|
||||
// Open game_io
|
||||
game_port = CreateMsgPort();
|
||||
game_io = (struct IOStdReq *)CreateIORequest(game_port, sizeof(IOStdReq));
|
||||
game_io->io_Message.mn_Node.ln_Type = NT_UNKNOWN;
|
||||
game_open = port_allocated = false;
|
||||
if (!OpenDevice("gameport.device", 1, (struct IORequest *)game_io, 0))
|
||||
game_open = true;
|
||||
}
|
||||
|
||||
void C64::c64_ctor2(void)
|
||||
{
|
||||
// Initialize joystick variables
|
||||
joy_state = 0xff;
|
||||
|
||||
// Open timer_io
|
||||
timer_port = CreateMsgPort();
|
||||
timer_io = (struct timerequest *)CreateIORequest(timer_port, sizeof(struct timerequest));
|
||||
OpenDevice(TIMERNAME, UNIT_MICROHZ, (struct IORequest *)timer_io, 0);
|
||||
|
||||
// Get timer base
|
||||
TimerBase = timer_io->tr_node.io_Device;
|
||||
|
||||
// Preset speedometer start time
|
||||
GetSysTime(&start_time);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_dtor(void)
|
||||
{
|
||||
// Stop and delete timer_io
|
||||
if (timer_io != NULL) {
|
||||
if (!CheckIO((struct IORequest *)timer_io))
|
||||
WaitIO((struct IORequest *)timer_io);
|
||||
CloseDevice((struct IORequest *)timer_io);
|
||||
DeleteIORequest((struct IORequest *)timer_io);
|
||||
}
|
||||
|
||||
if (timer_port != NULL)
|
||||
DeleteMsgPort(timer_port);
|
||||
|
||||
if (game_open) {
|
||||
if (!CheckIO((struct IORequest *)game_io)) {
|
||||
AbortIO((struct IORequest *)game_io);
|
||||
WaitIO((struct IORequest *)game_io);
|
||||
}
|
||||
CloseDevice((struct IORequest *)game_io);
|
||||
}
|
||||
|
||||
if (game_io != NULL)
|
||||
DeleteIORequest((struct IORequest *)game_io);
|
||||
|
||||
if (game_port != NULL)
|
||||
DeleteMsgPort(game_port);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start emulation
|
||||
*/
|
||||
|
||||
void C64::Run(void)
|
||||
{
|
||||
// Reset chips
|
||||
TheCPU->Reset();
|
||||
TheSID->Reset();
|
||||
TheCIA1->Reset();
|
||||
TheCIA2->Reset();
|
||||
TheCPU1541->Reset();
|
||||
|
||||
// Patch kernal IEC routines
|
||||
orig_kernal_1d84 = Kernal[0x1d84];
|
||||
orig_kernal_1d85 = Kernal[0x1d85];
|
||||
PatchKernal(ThePrefs.FastReset, ThePrefs.Emul1541Proc);
|
||||
|
||||
// Start timer_io
|
||||
timer_io->tr_node.io_Command = TR_ADDREQUEST;
|
||||
timer_io->tr_time.tv_secs = 0;
|
||||
timer_io->tr_time.tv_micro = ThePrefs.SkipFrames * 20000; // 20ms per frame
|
||||
SendIO((struct IORequest *)timer_io);
|
||||
|
||||
// Start the CPU thread
|
||||
thread_running = true;
|
||||
quit_thyself = false;
|
||||
have_a_break = false;
|
||||
thread_func();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stop emulation
|
||||
*/
|
||||
|
||||
void C64::Quit(void)
|
||||
{
|
||||
// Ask the thread to quit itself if it is running
|
||||
if (thread_running) {
|
||||
quit_thyself = true;
|
||||
thread_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pause emulation
|
||||
*/
|
||||
|
||||
void C64::Pause(void)
|
||||
{
|
||||
TheSID->PauseSound();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Resume emulation
|
||||
*/
|
||||
|
||||
void C64::Resume(void)
|
||||
{
|
||||
TheSID->ResumeSound();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Vertical blank: Poll keyboard and joysticks, update window
|
||||
*/
|
||||
|
||||
void C64::VBlank(bool draw_frame)
|
||||
{
|
||||
struct timeval end_time;
|
||||
long speed_index;
|
||||
|
||||
// Poll keyboard
|
||||
TheDisplay->PollKeyboard(TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
||||
|
||||
// Poll joysticks
|
||||
TheCIA1->Joystick1 = poll_joystick(0);
|
||||
TheCIA1->Joystick2 = poll_joystick(1);
|
||||
|
||||
if (ThePrefs.JoystickSwap) {
|
||||
uint8 tmp = TheCIA1->Joystick1;
|
||||
TheCIA1->Joystick1 = TheCIA1->Joystick2;
|
||||
TheCIA1->Joystick2 = tmp;
|
||||
}
|
||||
|
||||
// Joystick keyboard emulation
|
||||
if (TheDisplay->NumLock())
|
||||
TheCIA1->Joystick1 &= joykey;
|
||||
else
|
||||
TheCIA1->Joystick2 &= joykey;
|
||||
|
||||
// Count TOD clocks
|
||||
TheCIA1->CountTOD();
|
||||
TheCIA2->CountTOD();
|
||||
|
||||
// Update window if needed
|
||||
if (draw_frame) {
|
||||
TheDisplay->Update();
|
||||
|
||||
// Calculate time between VBlanks, display speedometer
|
||||
GetSysTime(&end_time);
|
||||
SubTime(&end_time, &start_time);
|
||||
speed_index = 20000 * 100 * ThePrefs.SkipFrames / (end_time.tv_micro + 1);
|
||||
|
||||
// Abort timer_io if speed limiter is off
|
||||
if (!ThePrefs.LimitSpeed) {
|
||||
if (!CheckIO((struct IORequest *)timer_io))
|
||||
AbortIO((struct IORequest *)timer_io);
|
||||
} else if (speed_index > 100)
|
||||
speed_index = 100;
|
||||
|
||||
// Wait for timer_io (limit speed)
|
||||
WaitIO((struct IORequest *)timer_io);
|
||||
|
||||
// Restart timer_io
|
||||
timer_io->tr_node.io_Command = TR_ADDREQUEST;
|
||||
timer_io->tr_time.tv_secs = 0;
|
||||
timer_io->tr_time.tv_micro = ThePrefs.SkipFrames * 20000; // 20ms per frame
|
||||
SendIO((struct IORequest *)timer_io);
|
||||
|
||||
GetSysTime(&start_time);
|
||||
|
||||
TheDisplay->Speedometer(speed_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open/close joystick drivers given old and new state of
|
||||
* joystick preferences
|
||||
*/
|
||||
|
||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
||||
{
|
||||
if (game_open && (oldjoy2 != newjoy2))
|
||||
|
||||
if (newjoy2) { // Open joystick
|
||||
joy_state = 0xff;
|
||||
port_allocated = false;
|
||||
|
||||
// Allocate game port
|
||||
BYTE ctype;
|
||||
Forbid();
|
||||
game_io->io_Command = GPD_ASKCTYPE;
|
||||
game_io->io_Data = &ctype;
|
||||
game_io->io_Length = 1;
|
||||
DoIO((struct IORequest *)game_io);
|
||||
|
||||
if (ctype != GPCT_NOCONTROLLER)
|
||||
Permit();
|
||||
else {
|
||||
ctype = GPCT_ABSJOYSTICK;
|
||||
game_io->io_Command = GPD_SETCTYPE;
|
||||
game_io->io_Data = &ctype;
|
||||
game_io->io_Length = 1;
|
||||
DoIO((struct IORequest *)game_io);
|
||||
Permit();
|
||||
|
||||
port_allocated = true;
|
||||
|
||||
// Set trigger conditions
|
||||
game_trigger.gpt_Keys = GPTF_UPKEYS | GPTF_DOWNKEYS;
|
||||
game_trigger.gpt_Timeout = 65535;
|
||||
game_trigger.gpt_XDelta = 1;
|
||||
game_trigger.gpt_YDelta = 1;
|
||||
game_io->io_Command = GPD_SETTRIGGER;
|
||||
game_io->io_Data = &game_trigger;
|
||||
game_io->io_Length = sizeof(struct GamePortTrigger);
|
||||
DoIO((struct IORequest *)game_io);
|
||||
|
||||
// Flush device buffer
|
||||
game_io->io_Command = CMD_CLEAR;
|
||||
DoIO((struct IORequest *)game_io);
|
||||
|
||||
// Start reading joystick events
|
||||
game_io->io_Command = GPD_READEVENT;
|
||||
game_io->io_Data = &game_event;
|
||||
game_io->io_Length = sizeof(struct InputEvent);
|
||||
SendIO((struct IORequest *)game_io);
|
||||
}
|
||||
|
||||
} else { // Close joystick
|
||||
|
||||
// Abort game_io
|
||||
if (!CheckIO((struct IORequest *)game_io)) {
|
||||
AbortIO((struct IORequest *)game_io);
|
||||
WaitIO((struct IORequest *)game_io);
|
||||
}
|
||||
|
||||
// Free game port
|
||||
if (port_allocated) {
|
||||
BYTE ctype = GPCT_NOCONTROLLER;
|
||||
game_io->io_Command = GPD_SETCTYPE;
|
||||
game_io->io_Data = &ctype;
|
||||
game_io->io_Length = 1;
|
||||
DoIO((struct IORequest *)game_io);
|
||||
|
||||
port_allocated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll joystick port, return CIA mask
|
||||
*/
|
||||
|
||||
uint8 C64::poll_joystick(int port)
|
||||
{
|
||||
if (port == 0)
|
||||
return 0xff;
|
||||
|
||||
if (game_open && port_allocated) {
|
||||
|
||||
// Joystick event arrived?
|
||||
while (GetMsg(game_port) != NULL) {
|
||||
|
||||
// Yes, analyze event
|
||||
switch (game_event.ie_Code) {
|
||||
case IECODE_LBUTTON: // Button pressed
|
||||
joy_state &= 0xef;
|
||||
break;
|
||||
|
||||
case IECODE_LBUTTON | IECODE_UP_PREFIX: // Button released
|
||||
joy_state |= 0x10;
|
||||
break;
|
||||
|
||||
case IECODE_NOBUTTON: // Joystick moved
|
||||
if (game_event.ie_X == 1)
|
||||
joy_state &= 0xf7; // Right
|
||||
if (game_event.ie_X == -1)
|
||||
joy_state &= 0xfb; // Left
|
||||
if (game_event.ie_X == 0)
|
||||
joy_state |= 0x0c;
|
||||
if (game_event.ie_Y == 1)
|
||||
joy_state &= 0xfd; // Down
|
||||
if (game_event.ie_Y == -1)
|
||||
joy_state &= 0xfe; // Up
|
||||
if (game_event.ie_Y == 0)
|
||||
joy_state |= 0x03;
|
||||
break;
|
||||
}
|
||||
|
||||
// Start reading the next event
|
||||
game_io->io_Command = GPD_READEVENT;
|
||||
game_io->io_Data = &game_event;
|
||||
game_io->io_Length = sizeof(struct InputEvent);
|
||||
SendIO((struct IORequest *)game_io);
|
||||
}
|
||||
return joy_state;
|
||||
|
||||
} else
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The emulation's main loop
|
||||
*/
|
||||
|
||||
void C64::thread_func(void)
|
||||
{
|
||||
while (!quit_thyself) {
|
||||
|
||||
#ifdef FRODO_SC
|
||||
// The order of calls is important here
|
||||
if (TheVIC->EmulateCycle())
|
||||
TheSID->EmulateLine();
|
||||
TheCIA1->CheckIRQs();
|
||||
TheCIA2->CheckIRQs();
|
||||
TheCIA1->EmulateCycle();
|
||||
TheCIA2->EmulateCycle();
|
||||
TheCPU->EmulateCycle();
|
||||
|
||||
if (ThePrefs.Emul1541Proc) {
|
||||
TheCPU1541->CountVIATimers(1);
|
||||
if (!TheCPU1541->Idle)
|
||||
TheCPU1541->EmulateCycle();
|
||||
}
|
||||
CycleCounter++;
|
||||
#else
|
||||
// The order of calls is important here
|
||||
int cycles = TheVIC->EmulateLine();
|
||||
TheSID->EmulateLine();
|
||||
#if !PRECISE_CIA_CYCLES
|
||||
TheCIA1->EmulateLine(ThePrefs.CIACycles);
|
||||
TheCIA2->EmulateLine(ThePrefs.CIACycles);
|
||||
#endif
|
||||
|
||||
if (ThePrefs.Emul1541Proc) {
|
||||
int cycles_1541 = ThePrefs.FloppyCycles;
|
||||
TheCPU1541->CountVIATimers(cycles_1541);
|
||||
|
||||
if (!TheCPU1541->Idle) {
|
||||
// 1541 processor active, alternately execute
|
||||
// 6502 and 6510 instructions until both have
|
||||
// used up their cycles
|
||||
while (cycles >= 0 || cycles_1541 >= 0)
|
||||
if (cycles > cycles_1541)
|
||||
cycles -= TheCPU->EmulateLine(1);
|
||||
else
|
||||
cycles_1541 -= TheCPU1541->EmulateLine(1);
|
||||
} else
|
||||
TheCPU->EmulateLine(cycles);
|
||||
} else
|
||||
// 1541 processor disabled, only emulate 6510
|
||||
TheCPU->EmulateLine(cycles);
|
||||
#endif
|
||||
}
|
||||
}
|
452
Src/C64_WIN32.h
452
Src/C64_WIN32.h
@ -1,452 +0,0 @@
|
||||
/*
|
||||
* C64_WIN32.h - Put the pieces together, WIN32 specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <process.h>
|
||||
#include "main.h"
|
||||
|
||||
#define FRAME_INTERVAL (1000/SCREEN_FREQ) // in milliseconds
|
||||
#ifdef FRODO_SC
|
||||
#define SPEEDOMETER_INTERVAL 4000 // in milliseconds
|
||||
#else
|
||||
#define SPEEDOMETER_INTERVAL 1000 // in milliseconds
|
||||
#endif
|
||||
#define JOYSTICK_SENSITIVITY 40 // % of live range
|
||||
#define JOYSTICK_MIN 0x0000 // min value of range
|
||||
#define JOYSTICK_MAX 0xffff // max value of range
|
||||
#define JOYSTICK_RANGE (JOYSTICK_MAX - JOYSTICK_MIN)
|
||||
|
||||
static BOOL high_resolution_timer = FALSE;
|
||||
|
||||
/*
|
||||
* Constructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_ctor1()
|
||||
{
|
||||
Debug("C64::c64_ctor1\n");
|
||||
|
||||
// Initialize joystick variables.
|
||||
joy_state = 0xff;
|
||||
|
||||
// No need to check for state change.
|
||||
state_change = FALSE;
|
||||
|
||||
// Start the synchronization timer.
|
||||
timer_semaphore = NULL;
|
||||
timer_id = NULL;
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
void C64::c64_ctor2()
|
||||
{
|
||||
Debug("C64::c64_ctor2\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_dtor()
|
||||
{
|
||||
Debug("C64::c64_dtor\n");
|
||||
|
||||
StopTimer();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start emulation
|
||||
*/
|
||||
|
||||
void C64::Run()
|
||||
{
|
||||
// Reset chips
|
||||
TheCPU->Reset();
|
||||
TheSID->Reset();
|
||||
TheCIA1->Reset();
|
||||
TheCIA2->Reset();
|
||||
TheCPU1541->Reset();
|
||||
|
||||
// Patch kernal IEC routines
|
||||
orig_kernal_1d84 = Kernal[0x1d84];
|
||||
orig_kernal_1d85 = Kernal[0x1d85];
|
||||
patch_kernal(ThePrefs.FastReset, ThePrefs.Emul1541Proc);
|
||||
|
||||
// Start the CPU thread
|
||||
thread_func();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stop emulation
|
||||
*/
|
||||
|
||||
void C64::Quit()
|
||||
{
|
||||
// Ask the thread to quit itself if it is running
|
||||
quit_thyself = TRUE;
|
||||
state_change = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pause emulation
|
||||
*/
|
||||
|
||||
void C64::Pause()
|
||||
{
|
||||
StopTimer();
|
||||
TheSID->PauseSound();
|
||||
have_a_break = TRUE;
|
||||
state_change = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Resume emulation
|
||||
*/
|
||||
|
||||
void C64::Resume()
|
||||
{
|
||||
StartTimer();
|
||||
TheSID->ResumeSound();
|
||||
have_a_break = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Vertical blank: Poll keyboard and joysticks, update window
|
||||
*/
|
||||
|
||||
void C64::VBlank(bool draw_frame)
|
||||
{
|
||||
//Debug("C64::VBlank\n");
|
||||
|
||||
// Poll the keyboard.
|
||||
TheDisplay->PollKeyboard(TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
||||
// Poll the joysticks.
|
||||
TheCIA1->Joystick1 = poll_joystick(0);
|
||||
TheCIA1->Joystick2 = poll_joystick(1);
|
||||
|
||||
if (ThePrefs.JoystickSwap) {
|
||||
uint8 tmp = TheCIA1->Joystick1;
|
||||
TheCIA1->Joystick1 = TheCIA1->Joystick2;
|
||||
TheCIA1->Joystick2 = tmp;
|
||||
}
|
||||
|
||||
// Joystick keyboard emulation.
|
||||
if (TheDisplay->NumLock())
|
||||
TheCIA1->Joystick1 &= joykey;
|
||||
else
|
||||
TheCIA1->Joystick2 &= joykey;
|
||||
|
||||
// Count TOD clocks.
|
||||
TheCIA1->CountTOD();
|
||||
TheCIA2->CountTOD();
|
||||
|
||||
#if 1
|
||||
// Output a frag.
|
||||
TheSID->VBlank();
|
||||
#endif
|
||||
|
||||
if (have_a_break)
|
||||
return;
|
||||
|
||||
// Update the window if needed.
|
||||
frame++;
|
||||
if (draw_frame) {
|
||||
|
||||
// Synchronize to the timer if limiting the speed.
|
||||
if (ThePrefs.LimitSpeed) {
|
||||
if (skipped_frames == 0) {
|
||||
// There is a tiny race condtion here that
|
||||
// could cause a full extra delay cycle.
|
||||
WaitForSingleObject(timer_semaphore, INFINITE);
|
||||
}
|
||||
else {
|
||||
Debug("*** Skipped a frame! ***\n");
|
||||
skipped_frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Perform the actual screen update exactly at the
|
||||
// beginning of an interval for the smoothest video.
|
||||
TheDisplay->Update();
|
||||
|
||||
// Compute the speed index and show it in the speedometer.
|
||||
DWORD now = timeGetTime();
|
||||
int elapsed_time = now - ref_time;
|
||||
if (now - ref_time >= SPEEDOMETER_INTERVAL) {
|
||||
double speed_index = double(frame * FRAME_INTERVAL * 100 + elapsed_time/2) / elapsed_time;
|
||||
TheDisplay->Speedometer((int)speed_index);
|
||||
ref_time = now;
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
// Make sure our timer is set correctly.
|
||||
CheckTimerChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C64::CheckTimerChange()
|
||||
{
|
||||
// Make sure the timer interval matches the preferences.
|
||||
if (!ThePrefs.LimitSpeed && timer_every == 0)
|
||||
return;
|
||||
if (ThePrefs.LimitSpeed && ThePrefs.SkipFrames == timer_every)
|
||||
return;
|
||||
StopTimer();
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
/*
|
||||
* Open/close joystick drivers given old and new state of
|
||||
* joystick preferences
|
||||
*/
|
||||
|
||||
BOOL joystick_open[2];
|
||||
|
||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
||||
{
|
||||
if (oldjoy1 != newjoy1) {
|
||||
joystick_open[0] = FALSE;
|
||||
if (newjoy1) {
|
||||
JOYINFO joyinfo;
|
||||
if (joyGetPos(0, &joyinfo) == JOYERR_NOERROR)
|
||||
joystick_open[0] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldjoy2 != newjoy2) {
|
||||
joystick_open[1] = FALSE;
|
||||
if (newjoy1) {
|
||||
JOYINFO joyinfo;
|
||||
if (joyGetPos(1, &joyinfo) == JOYERR_NOERROR)
|
||||
joystick_open[1] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Should have our own new prefs!
|
||||
state_change = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll joystick port, return CIA mask
|
||||
*/
|
||||
|
||||
uint8 C64::poll_joystick(int port)
|
||||
{
|
||||
uint8 j = 0xff;
|
||||
|
||||
if (joystick_open[port]) {
|
||||
JOYINFO joyinfo;
|
||||
if (joyGetPos(port, &joyinfo) == JOYERR_NOERROR) {
|
||||
int x = joyinfo.wXpos;
|
||||
int y = joyinfo.wYpos;
|
||||
int buttons = joyinfo.wButtons;
|
||||
int s1 = JOYSTICK_SENSITIVITY;
|
||||
int s2 = 100 - JOYSTICK_SENSITIVITY;
|
||||
if (x < JOYSTICK_MIN + s1*JOYSTICK_RANGE/100)
|
||||
j &= 0xfb; // Left
|
||||
else if (x > JOYSTICK_MIN + s2*JOYSTICK_RANGE/100)
|
||||
j &= 0xf7; // Right
|
||||
if (y < JOYSTICK_MIN + s1*JOYSTICK_RANGE/100)
|
||||
j &= 0xfe; // Up
|
||||
else if (y > JOYSTICK_MIN + s2*JOYSTICK_RANGE/100)
|
||||
j &= 0xfd; // Down
|
||||
if (buttons & 1)
|
||||
j &= 0xef; // Button
|
||||
if (buttons & 2) {
|
||||
Pause();
|
||||
while (joyGetPos(port, &joyinfo) == JOYERR_NOERROR && (joyinfo.wButtons & 2))
|
||||
Sleep(100);
|
||||
Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
void C64::StartTimer()
|
||||
{
|
||||
ref_time = timeGetTime();
|
||||
skipped_frames = 0;
|
||||
frame = 0;
|
||||
|
||||
if (!ThePrefs.LimitSpeed) {
|
||||
timer_every = 0;
|
||||
StopTimer();
|
||||
return;
|
||||
}
|
||||
timer_every = ThePrefs.SkipFrames;
|
||||
|
||||
if (!timer_semaphore) {
|
||||
timer_semaphore = CreateSemaphore(NULL, 0, 1, NULL);
|
||||
if (!timer_semaphore)
|
||||
Debug("CreateSemaphore failed\n");
|
||||
}
|
||||
|
||||
if (!timer_id) {
|
||||
|
||||
// Turn on high-resolution times and delays.
|
||||
int resolution = FRAME_INTERVAL;
|
||||
if (high_resolution_timer) {
|
||||
timeBeginPeriod(1);
|
||||
resolution = 0;
|
||||
}
|
||||
|
||||
timer_id = timeSetEvent(timer_every*FRAME_INTERVAL, resolution, StaticTimeProc, (DWORD) this, TIME_PERIODIC);
|
||||
if (!timer_id)
|
||||
Debug("timeSetEvent failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
void C64::StopTimer()
|
||||
{
|
||||
if (timer_semaphore) {
|
||||
CloseHandle(timer_semaphore);
|
||||
timer_semaphore = NULL;
|
||||
}
|
||||
if (timer_id) {
|
||||
timeKillEvent(timer_id);
|
||||
timer_id = NULL;
|
||||
|
||||
// Turn off high-resolution delays.
|
||||
if (high_resolution_timer)
|
||||
timeEndPeriod(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CALLBACK C64::StaticTimeProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
|
||||
{
|
||||
C64* TheC64 = (C64 *) dwUser;
|
||||
TheC64->TimeProc(uID);
|
||||
}
|
||||
|
||||
void C64::TimeProc(UINT id)
|
||||
{
|
||||
if (id != timer_id) {
|
||||
Debug("TimeProc called for wrong timer id!\n");
|
||||
timeKillEvent(id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ReleaseSemaphore(timer_semaphore, 1, NULL))
|
||||
skipped_frames++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The emulation's main loop
|
||||
*/
|
||||
|
||||
void C64::thread_func()
|
||||
{
|
||||
Debug("C64::thread_func\n");
|
||||
|
||||
thread_running = TRUE;
|
||||
|
||||
while (!quit_thyself) {
|
||||
|
||||
if (have_a_break)
|
||||
TheDisplay->WaitUntilActive();
|
||||
|
||||
#ifdef FRODO_SC
|
||||
if (ThePrefs.Emul1541Proc)
|
||||
EmulateCyclesWith1541();
|
||||
else
|
||||
EmulateCyclesWithout1541();
|
||||
state_change = FALSE;
|
||||
#else
|
||||
// The order of calls is important here
|
||||
int cycles = TheVIC->EmulateLine();
|
||||
TheSID->EmulateLine();
|
||||
#if !PRECISE_CIA_CYCLES
|
||||
TheCIA1->EmulateLine(ThePrefs.CIACycles);
|
||||
TheCIA2->EmulateLine(ThePrefs.CIACycles);
|
||||
#endif
|
||||
if (ThePrefs.Emul1541Proc) {
|
||||
int cycles_1541 = ThePrefs.FloppyCycles;
|
||||
TheCPU1541->CountVIATimers(cycles_1541);
|
||||
|
||||
if (!TheCPU1541->Idle) {
|
||||
// 1541 processor active, alternately execute
|
||||
// 6502 and 6510 instructions until both have
|
||||
// used up their cycles
|
||||
while (cycles >= 0 || cycles_1541 >= 0)
|
||||
if (cycles > cycles_1541)
|
||||
cycles -= TheCPU->EmulateLine(1);
|
||||
else
|
||||
cycles_1541 -= TheCPU1541->EmulateLine(1);
|
||||
} else
|
||||
TheCPU->EmulateLine(cycles);
|
||||
} else
|
||||
// 1541 processor disabled, only emulate 6510
|
||||
TheCPU->EmulateLine(cycles);
|
||||
#endif
|
||||
}
|
||||
|
||||
thread_running = FALSE;
|
||||
|
||||
}
|
||||
|
||||
#ifdef FRODO_SC
|
||||
|
||||
void C64::EmulateCyclesWith1541()
|
||||
{
|
||||
thread_running = TRUE;
|
||||
while (!state_change) {
|
||||
// The order of calls is important here
|
||||
if (TheVIC->EmulateCycle())
|
||||
TheSID->EmulateLine();
|
||||
#ifndef BATCH_CIA_CYCLES
|
||||
TheCIA1->EmulateCycle();
|
||||
TheCIA2->EmulateCycle();
|
||||
#endif
|
||||
TheCPU->EmulateCycle();
|
||||
TheCPU1541->CountVIATimers(1);
|
||||
if (!TheCPU1541->Idle)
|
||||
TheCPU1541->EmulateCycle();
|
||||
CycleCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
void C64::EmulateCyclesWithout1541()
|
||||
{
|
||||
thread_running = TRUE;
|
||||
while (!state_change) {
|
||||
// The order of calls is important here
|
||||
if (TheVIC->EmulateCycle())
|
||||
TheSID->EmulateLine();
|
||||
#ifndef BATCH_CIA_CYCLES
|
||||
TheCIA1->EmulateCycle();
|
||||
TheCIA2->EmulateCycle();
|
||||
#endif
|
||||
TheCPU->EmulateCycle();
|
||||
CycleCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,441 +0,0 @@
|
||||
/*
|
||||
* Display_Acorn.h - C64 graphics display, emulator window handling,
|
||||
* RISC OS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2009 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "C64.h"
|
||||
#include "ROlib.h"
|
||||
#include "AcornGUI.h"
|
||||
#include "SAM.h"
|
||||
#include "VIC.h"
|
||||
|
||||
|
||||
|
||||
// (from Display_x.i)
|
||||
/*
|
||||
C64 keyboard matrix:
|
||||
|
||||
Bit 7 6 5 4 3 2 1 0
|
||||
0 CUD F5 F3 F1 F7 CLR RET DEL
|
||||
1 SHL E S Z 4 A W 3
|
||||
2 X T F C 6 D R 5
|
||||
3 V U H B 8 G Y 7
|
||||
4 N O K M 0 J I 9
|
||||
5 , @ : . - L P +
|
||||
6 / ^ = SHR HOM ; * £
|
||||
7 R/S Q C= SPC 2 CTL <- 1
|
||||
*/
|
||||
|
||||
|
||||
#define IntKey_MinCode 3 // Scan from ShiftLeft (leave out Shift, Ctrl, Alt)
|
||||
#define IntKey_MaxCode 124
|
||||
#define IntKey_Copy 105
|
||||
|
||||
// Maps internal keyboard numbers (Acorn) to C64 keyboard-matrix.
|
||||
// Format: top nibble - row#, bottom nibble - column (bit#).
|
||||
// Entry == 0xff <==> don't map
|
||||
char KeysAcornToCBM[] = {
|
||||
0x17, 0x72, 0x75, 0x17, // 0 - 3: SHL, CTRL, ALT(C=), SHL
|
||||
0x72, 0x75, 0x64, 0x72, // 4 - 7: CTRL, ALT, SHR, CTRL
|
||||
0x75, 0xff, 0xff, 0xff, // 8 - 11: ALT, MouseSlct, MouseMen, MouseAdj
|
||||
0xff, 0xff, 0xff, 0xff, // 12 - 15: dummies
|
||||
0x76, 0x10, 0x13, 0x20, // 16 - 19: q, 3,4,5
|
||||
0x03, 0x33, 0xff, 0x53, // 20 - 23: F4(F7), 8, F7, -
|
||||
0x23, 0x02, 0xff, 0xff, // 24 - 27: 6, crsrL, num6, num7
|
||||
0xff, 0xff, 0xff, 0xff, // 28 - 31: F11, F12, F10, ScrLock
|
||||
0xff, 0x11, 0x16, 0x26, // 32 - 35: Print, w, e, t
|
||||
0x30, 0x41, 0x40, 0x43, // 36 - 39: 7, i, 9, 0
|
||||
0x53, 0x07, 0xff, 0xff, // 40 - 43: -, crsrD, num8, num9
|
||||
0x77, 0x71, 0x60, 0x00, // 44 - 47: break, `, £, DEL
|
||||
0x70, 0x73, 0x22, 0x21, // 48 - 51: 1, 2, d, r
|
||||
0x23, 0x36, 0x46, 0x51, // 52 - 55: 6, u, o, p
|
||||
0x56, 0x07, 0x50, 0x53, // 56 - 59: [(@), crsrU, num+(+), num-(-)
|
||||
0xff, 0x00, 0x63, 0xff, // 60 - 63: numENTER, insert, home, pgUp
|
||||
0x17, 0x12, 0x27, 0x25, // 64 - 67: capsLCK, a, x, f
|
||||
0x31, 0x42, 0x45, 0x73, // 68 - 71: y, j, k, 2
|
||||
0x55, 0x01, 0xff, 0xff, // 72 - 75: ;(:), RET, num/, dummy
|
||||
0xff, 0xff, 0xff, 0x62, // 76 - 79: num., numLCK, pgDown, '(;)
|
||||
0xff, 0x15, 0x24, 0x32, // 80 - 83: dummy, s, c, g
|
||||
0x35, 0x47, 0x52, 0x55, // 84 - 87: h, n, l, ;(:)
|
||||
0x61, 0x00, 0xff, 0xff, // 88 - 91: ](*), Delete, num#, num*
|
||||
0xff, 0x65, 0xff, 0xff, // 92 - 95: dummy, =, dummies
|
||||
0x72, 0x14, 0x74, 0x37, // 96 - 99: TAB(CTRL), z, SPACE, v
|
||||
0x34, 0x44, 0x57, 0x54, // 100-103: b, m, ',', .
|
||||
0x67, 0xff, 0xff, 0xff, // 104-107: /, Copy, num0, num1
|
||||
0xff, 0xff, 0xff, 0xff, // 108-111: num3, dummies
|
||||
0x77, 0x04, 0x05, 0x06, // 112-115: ESC, F1(F1), F2(F3), F3(F5)
|
||||
0xff, 0xff, 0xff, 0xff, // 116-119: F5, F6, F8, F9
|
||||
0x66, 0x02, 0xff, 0xff, // 120-123: \(^), crsrR, num4, num5
|
||||
0xff, 0xff, 0xff, 0xff // 124-127: num2, dummies
|
||||
};
|
||||
|
||||
|
||||
// Special keycodes that have to be processed seperately:
|
||||
#define IntKey_CrsrL 25
|
||||
#define IntKey_CrsrR 121
|
||||
#define IntKey_CrsrU 57
|
||||
#define IntKey_CrsrD 41
|
||||
#define IntKey_Insert 61
|
||||
#define IntKey_NumLock 77
|
||||
#define IntKey_F5 116
|
||||
#define IntKey_F6 117
|
||||
#define IntKey_F7 22
|
||||
#define IntKey_F8 118
|
||||
#define IntKey_PageUp 63
|
||||
#define IntKey_PageDown 78
|
||||
#define IntKey_NumSlash 74
|
||||
#define IntKey_NumStar 91
|
||||
#define IntKey_NumCross 90
|
||||
|
||||
#define KeyJoy1_Up 108 // num3
|
||||
#define KeyJoy1_Down 76 // num.
|
||||
#define KeyJoy1_Left 107 // num1
|
||||
#define KeyJoy1_Right 124 // num2
|
||||
#define KeyJoy1_Fire 60 // numReturn
|
||||
#define KeyJoy2_Up 67 // "f"
|
||||
#define KeyJoy2_Down 82 // "c"
|
||||
#define KeyJoy2_Left 97 // "z"
|
||||
#define KeyJoy2_Right 66 // "x"
|
||||
#define KeyJoy2_Fire 83 // "g"
|
||||
|
||||
|
||||
|
||||
|
||||
C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
{
|
||||
int i;
|
||||
|
||||
bitmap = new uint8[DISPLAY_X * DISPLAY_Y];
|
||||
screen = new ROScreen();
|
||||
ModeChange();
|
||||
for (i=0; i<8; i++) {lastkeys[i] = 0;}
|
||||
// First joystick: mapped to port 2 if numLOCK is on, else port 2
|
||||
JoystickKeys[0].up = KeyJoy1_Up; JoystickKeys[0].down = KeyJoy1_Down;
|
||||
JoystickKeys[0].left = KeyJoy1_Left; JoystickKeys[0].right = KeyJoy1_Right;
|
||||
JoystickKeys[0].fire = KeyJoy1_Fire;
|
||||
// Second joystick: only active if numLOCK is off! Mapped to port 2 then.
|
||||
JoystickKeys[1].up = KeyJoy2_Up; JoystickKeys[1].down = KeyJoy2_Down;
|
||||
JoystickKeys[1].left = KeyJoy2_Left; JoystickKeys[1].right = KeyJoy2_Right;
|
||||
JoystickKeys[1].fire = KeyJoy2_Fire;
|
||||
}
|
||||
|
||||
|
||||
C64Display::~C64Display(void)
|
||||
{
|
||||
delete bitmap; delete screen;
|
||||
}
|
||||
|
||||
|
||||
void C64Display::ModeChange(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
screen->ReadMode();
|
||||
// find best matching colours in current mode.
|
||||
switch (screen->ldbpp)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3: for (i=0; i<16; i++) // for 1,2,4 and 8bpp
|
||||
{
|
||||
mode_cols[i] = ModeColourNumber((palette_blue[i] << 24) + (palette_green[i] << 16) + (palette_red[i] << 8));
|
||||
}
|
||||
break;
|
||||
case 4: for (i=0; i<16; i++) // for 16bpp
|
||||
{
|
||||
int r,g,b;
|
||||
|
||||
r = (palette_red[i] + 4) & 0x1f8; if (r > 0xff) {r = 0xf8;}
|
||||
g = (palette_green[i] + 4) & 0x1f8; if (g > 0xff) {g = 0xf8;}
|
||||
b = (palette_blue[i] + 4) & 0x1f8; if (b > 0xff) {b = 0xf8;}
|
||||
mode_cols[i] = (r >> 3) | (g << 2) | (b << 7);
|
||||
}
|
||||
break;
|
||||
case 5: for (i=0; i<16; i++) // for 32bpp
|
||||
{
|
||||
mode_cols[i] = palette_red[i] | (palette_green[i] << 8) | (palette_blue[i] << 16);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8 *C64Display::BitmapBase(void)
|
||||
{
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
void C64Display::InitColors(uint8 *colors)
|
||||
{
|
||||
register int i;
|
||||
|
||||
// write index mapping C64colours -> ROcolours
|
||||
if (screen->ldbpp <= 3) // at most 8bpp ==> use actual colour
|
||||
{
|
||||
for (i=0; i<256; i++) {colors[i] = mode_cols[i&15];}
|
||||
}
|
||||
else // else use index (takes time but can't be changed...
|
||||
{
|
||||
for (i=0; i<256; i++) {colors[i] = i&15;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int C64Display::BitmapXMod(void)
|
||||
{
|
||||
return DISPLAY_X;
|
||||
}
|
||||
|
||||
|
||||
// This routine reads the raw keyboard data from the host machine. Not entirely
|
||||
// conformant with Acorn's rules but the only way to detect multiple simultaneous
|
||||
// keypresses.
|
||||
void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick, uint8 *joystick2)
|
||||
{
|
||||
register int scan_from=IntKey_MinCode, code, row, col;
|
||||
int status;
|
||||
uint8 kjoy, kjoy2;
|
||||
uint32 newkeys[8];
|
||||
UBYTE kjoy, kjoy2;
|
||||
|
||||
// Clear keyboard
|
||||
for (code=0; code<8; code++) {key_matrix[code] = 0xff; rev_matrix[code] = 0xff; newkeys[code] = 0;}
|
||||
kjoy = kjoy2 = 0xff;
|
||||
status = ReadKeyboardStatus();
|
||||
if ((status & 16) == 0) {key_matrix[1] &= 0x7f; rev_matrix[7] &= 0xfd;} // Caps lock
|
||||
|
||||
while (scan_from <= IntKey_MaxCode)
|
||||
{
|
||||
if ((code = ScanKeys(scan_from)) != 0xff)
|
||||
{
|
||||
newkeys[code >> 5] |= (1 << (code & 0x1f)); // update keys pressed
|
||||
row = KeysAcornToCBM[code];
|
||||
if ((status & 4) != 0) // numLOCK off? ==> check for 2nd keyboard joystick too
|
||||
{
|
||||
if (code == JoystickKeys[1].up) {kjoy2 &= 0xfe; row = 0xff;}
|
||||
else if (code == JoystickKeys[1].down) {kjoy2 &= 0xfd; row = 0xff;}
|
||||
else if (code == JoystickKeys[1].left) {kjoy2 &= 0xfb; row = 0xff;}
|
||||
else if (code == JoystickKeys[1].right) {kjoy2 &= 0xf7; row = 0xff;}
|
||||
else if (code == JoystickKeys[1].fire) {kjoy2 &= 0xef; row = 0xff;}
|
||||
}
|
||||
// check 1st keyboard joystick
|
||||
if (code == JoystickKeys[0].up) {kjoy &= 0xfe; row = 0xff;}
|
||||
else if (code == JoystickKeys[0].down) {kjoy &= 0xfd; row = 0xff;}
|
||||
else if (code == JoystickKeys[0].left) {kjoy &= 0xfb; row = 0xff;}
|
||||
else if (code == JoystickKeys[0].right) {kjoy &= 0xf7; row = 0xff;}
|
||||
else if (code == JoystickKeys[0].fire) {kjoy &= 0xef; row = 0xff;}
|
||||
|
||||
// If key not mapped to joystick: try mapping to keyboard
|
||||
if (row != 0xff)
|
||||
{
|
||||
col = row & 7; row >>= 4;
|
||||
key_matrix[row] &= ~(1<<col); rev_matrix[col] &= ~(1<<row);
|
||||
}
|
||||
|
||||
// None of the keys listed below should be used for
|
||||
// joystick definitions since they're always used here.
|
||||
switch(code)
|
||||
{
|
||||
// For either of these: additionally set SHIFT key.
|
||||
case IntKey_CrsrL: // already mapped to CrsrL
|
||||
case IntKey_CrsrU: // already mapped to CrsrD
|
||||
case IntKey_Insert: // already mapped to DEL
|
||||
key_matrix[6] &= (0xff - (1<<4)); rev_matrix[4] &= (0xff - (1<<6));
|
||||
break;
|
||||
case IntKey_F6:
|
||||
if ((status & 2) == 0) // call SAM only in multitasking mode!
|
||||
{
|
||||
TheC64->Pause(); SAM(TheC64); TheC64->Resume();
|
||||
}
|
||||
break;
|
||||
case IntKey_F7: TheC64->NMI(); break;
|
||||
case IntKey_F8: TheC64->Reset(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// These shouldn't auto-repeat, therefore I check them seperately.
|
||||
if ((lastkeys[code >> 5] & (1 << (code & 0x1f))) == 0)
|
||||
{
|
||||
// Icons should be updated, not force-redrawed (--> single tasking)
|
||||
switch (code)
|
||||
{
|
||||
// decrease framerate
|
||||
case IntKey_PageUp:
|
||||
TheC64->TheWIMP->PrefsWindow->
|
||||
WriteIconNumberU(Icon_Prefs_SkipFText,++ThePrefs.SkipFrames);
|
||||
break;
|
||||
// increase framerate
|
||||
case IntKey_PageDown: if (ThePrefs.SkipFrames > 0)
|
||||
{
|
||||
TheC64->TheWIMP->PrefsWindow->
|
||||
WriteIconNumberU(Icon_Prefs_SkipFText,--ThePrefs.SkipFrames);
|
||||
}
|
||||
break;
|
||||
// toggle floppy emulation status
|
||||
case IntKey_NumSlash:
|
||||
{
|
||||
register int eor, i;
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
|
||||
// If Emulation active then ungrey icons now, else grey them
|
||||
prefs->Emul1541Proc = !prefs->Emul1541Proc;
|
||||
TheC64->TheWIMP->SetLEDIcons(prefs->Emul1541Proc);
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
// Show change in prefs window too
|
||||
TheC64->TheWIMP->PrefsWindow->
|
||||
SetIconState(Icon_Prefs_Emul1541,(prefs->Emul1541Proc)?IFlg_Slct:0,IFlg_Slct);
|
||||
delete prefs;
|
||||
}
|
||||
break;
|
||||
// toggle speed limiter
|
||||
case IntKey_NumStar:
|
||||
ThePrefs.LimitSpeed = !ThePrefs.LimitSpeed;
|
||||
TheC64->TheWIMP->SetSpeedLimiter(ThePrefs.LimitSpeed);
|
||||
break;
|
||||
// toggle sound emulation
|
||||
case IntKey_F5:
|
||||
{
|
||||
Window *pw = TheC64->TheWIMP->PrefsWindow;
|
||||
int i, j;
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
|
||||
if (prefs->SIDType == SIDTYPE_NONE) {prefs->SIDType = SIDTYPE_DIGITAL; i = 1;}
|
||||
else {prefs->SIDType = SIDTYPE_NONE; i = 0;}
|
||||
for (j=0; j<3; j++)
|
||||
{
|
||||
pw->SetIconState(SIDtoIcon[j], (j==i) ? IFlg_Slct : 0, IFlg_Slct);
|
||||
}
|
||||
TheC64->TheWIMP->SoundWindow->
|
||||
SetIconState(Icon_Sound_Notes, (i==0) ? IFlg_Grey : 0, IFlg_Grey);
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
delete prefs;
|
||||
}
|
||||
break;
|
||||
case IntKey_Copy: TheC64->Pause();
|
||||
TheC64->TheWIMP->EmuPane->WriteIconTextU(Icon_Pane_Pause,PANE_TEXT_RESUME); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
scan_from = code+1;
|
||||
}
|
||||
for (code=0; code<8; code++) {lastkeys[code] = newkeys[code];}
|
||||
*joystick = kjoy; *joystick2 = kjoy2;
|
||||
}
|
||||
|
||||
|
||||
bool C64Display::NumLock(void)
|
||||
{
|
||||
return(((ReadKeyboardStatus() & 4) == 0) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prefs may have changed
|
||||
*/
|
||||
|
||||
void C64Display::NewPrefs(Prefs *prefs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void C64Display::Update(void)
|
||||
{
|
||||
int i, state;
|
||||
int *ic;
|
||||
|
||||
// Do a redraw of the emulator window
|
||||
TheC64->TheWIMP->UpdateEmuWindow();
|
||||
|
||||
// Update the LEDs if necessary
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
if ((state = led_state[i]) != old_led_state[i])
|
||||
{
|
||||
ic = (int*)TheC64->TheWIMP->EmuPane->GetIcon(LEDtoIcon[i]);
|
||||
switch(state)
|
||||
{
|
||||
case LED_OFF:
|
||||
case LED_ERROR_OFF:
|
||||
sprintf((char*)ic[5],"led_off"); break;
|
||||
case LED_ON:
|
||||
sprintf((char*)ic[5],"led_on"); break;
|
||||
case LED_ERROR_ON:
|
||||
sprintf((char*)ic[5],"led_error"); break;
|
||||
}
|
||||
TheC64->TheWIMP->EmuPane->UpdateIcon(LEDtoIcon[i]); // update, not force-redraw!
|
||||
old_led_state[i] = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned int *C64Display::GetColourTable(void)
|
||||
{
|
||||
return (mode_cols);
|
||||
}
|
||||
|
||||
|
||||
// Check whether unpause-key (copy) is pressed
|
||||
bool C64Display::CheckForUnpause(bool CheckLastState)
|
||||
{
|
||||
int scan_from = IntKey_MinCode, code;
|
||||
uint32 newkeys[8];
|
||||
uint32 lastpause;
|
||||
|
||||
for (code=0; code<8; code++) {newkeys[code] = 0;}
|
||||
|
||||
while (scan_from <= IntKey_MaxCode)
|
||||
{
|
||||
if ((code = ScanKeys(scan_from)) != 0xff)
|
||||
{
|
||||
newkeys[code >> 5] |= (1 << (code & 0x1f));
|
||||
}
|
||||
scan_from = code+1;
|
||||
}
|
||||
lastpause = lastkeys[IntKey_Copy >> 5] & (1 << (IntKey_Copy & 0x1f));
|
||||
for (code=0; code<8; code++) {lastkeys[code] = newkeys[code];}
|
||||
// unpause-key pressed?
|
||||
if ((newkeys[IntKey_Copy >> 5] & (1 << (IntKey_Copy & 0x1f))) != 0)
|
||||
{
|
||||
if ((lastpause == 0) || !CheckLastState)
|
||||
{
|
||||
TheC64->Resume();
|
||||
TheC64->TheWIMP->EmuPane->WriteIconTextU(Icon_Pane_Pause,PANE_TEXT_PAUSE);
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
// Requester dialogue box
|
||||
long ShowRequester(const char *str, const char *button1, const char *button2)
|
||||
{
|
||||
_kernel_oserror myerr;
|
||||
|
||||
myerr.errnum = 0x0; strcpy(myerr.errmess,str);
|
||||
Wimp_ReportError(&myerr,1,TASKNAME); // always provide an OK box
|
||||
return(1);
|
||||
}
|
@ -1,641 +0,0 @@
|
||||
/*
|
||||
* Display_Amiga.h - C64 graphics display, emulator window handling,
|
||||
* Amiga specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2009 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/memory.h>
|
||||
#include <intuition/intuition.h>
|
||||
#include <libraries/gadtools.h>
|
||||
#include <libraries/asl.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/graphics.h>
|
||||
#include <proto/intuition.h>
|
||||
#include <proto/dos.h>
|
||||
#include <proto/gadtools.h>
|
||||
#include <proto/diskfont.h>
|
||||
#include <proto/asl.h>
|
||||
|
||||
#include "C64.h"
|
||||
#include "SAM.h"
|
||||
#include "Version.h"
|
||||
|
||||
|
||||
/*
|
||||
C64 keyboard matrix:
|
||||
|
||||
Bit 7 6 5 4 3 2 1 0
|
||||
0 CUD F5 F3 F1 F7 CLR RET DEL
|
||||
1 SHL E S Z 4 A W 3
|
||||
2 X T F C 6 D R 5
|
||||
3 V U H B 8 G Y 7
|
||||
4 N O K M 0 J I 9
|
||||
5 , @ : . - L P +
|
||||
6 / ^ = SHR HOM ; * £
|
||||
7 R/S Q C= SPC 2 CTL <- 1
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Tables for key translation
|
||||
Bit 0..2: row/column in C64 keyboard matrix
|
||||
Bit 3 : implicit shift
|
||||
Bit 5 : joystick emulation (bit 0..4: mask)
|
||||
*/
|
||||
|
||||
const int key_byte[128] = {
|
||||
7, 7, 7, 1, 1, 2, 2, 3,
|
||||
3, 4, 4, 5, 5, 6, -1,0x30,
|
||||
7, 1, 1, 2, 2, 3, 3, 4,
|
||||
4, 5, 5, 6, -1,0x26,0x22,0x2a,
|
||||
1, 1, 2, 2, 3, 3, 4, 4,
|
||||
5, 5, 6, 6, -1,0x24,0x30,0x28,
|
||||
6, 1, 2, 2, 3, 3, 4, 4,
|
||||
5, 5, 6, -1, -1,0x25,0x21,0x29,
|
||||
7, 0, -1, 0, 0, 7, 6, -1,
|
||||
-1, -1, -1, -1,8+0, 0, 0, 8+0,
|
||||
0,8+0, 0,8+0, 0, 8+0, 0, 8+0,
|
||||
-1, -1, 6, 6, -1, -1, -1, -1,
|
||||
1, 6, 1, 7, 7, 7, 7, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
const int key_bit[128] = {
|
||||
1, 0, 3, 0, 3, 0, 3, 0,
|
||||
3, 0, 3, 0, 3, 0, -1, -1,
|
||||
6, 1, 6, 1, 6, 1, 6, 1,
|
||||
6, 1, 6, 1, -1, -1, -1, -1,
|
||||
2, 5, 2, 5, 2, 5, 2, 5,
|
||||
2, 5, 2, 5, -1, -1, -1, -1,
|
||||
6, 4, 7, 4, 7, 4, 7, 4,
|
||||
7, 4, 7, -1, -1, -1, -1, -1,
|
||||
4, 0, -1, 1, 1, 7, 3, -1,
|
||||
-1, -1, -1, -1, 7, 7, 2, 2,
|
||||
4, 4, 5, 5, 6, 6, 3, 3,
|
||||
-1, -1, 6, 5, -1, -1, -1, -1,
|
||||
7, 4, 7, 2, 5, 5, 5, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Menu definitions
|
||||
*/
|
||||
|
||||
const struct NewMenu new_menus[] = {
|
||||
NM_TITLE, "Frodo", NULL, 0, 0, NULL,
|
||||
NM_ITEM, "About Frodo...", NULL, 0, 0, NULL,
|
||||
NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL,
|
||||
NM_ITEM, "Preferences...", "P", 0, 0, NULL,
|
||||
NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL,
|
||||
NM_ITEM, "Reset C64", NULL, 0, 0, NULL,
|
||||
NM_ITEM, "Insert next disk", "D", 0, 0, NULL,
|
||||
NM_ITEM, "SAM...", "M", 0, 0, NULL,
|
||||
NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL,
|
||||
NM_ITEM, "Load snapshot...", "O", 0, 0, NULL,
|
||||
NM_ITEM, "Save snapshot...", "S", 0, 0, NULL,
|
||||
NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL,
|
||||
NM_ITEM, "Quit Frodo", "Q", 0, 0, NULL,
|
||||
NM_END, NULL, NULL, 0, 0, NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Font attributes
|
||||
*/
|
||||
|
||||
const struct TextAttr led_font_attr = {
|
||||
"Helvetica.font", 11, FS_NORMAL, 0
|
||||
};
|
||||
|
||||
const struct TextAttr speedo_font_attr = {
|
||||
"Courier.font", 11, FS_NORMAL, 0
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Display constructor: Create window/screen
|
||||
*/
|
||||
|
||||
C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
{
|
||||
int i;
|
||||
|
||||
// LEDs off
|
||||
for (i=0; i<4; i++)
|
||||
led_state[i] = old_led_state[i] = LED_OFF;
|
||||
|
||||
// Allocate chunky buffer to draw into
|
||||
chunky_buf = new UBYTE[DISPLAY_X * DISPLAY_Y];
|
||||
|
||||
// Open fonts
|
||||
led_font = OpenDiskFont(&led_font_attr);
|
||||
speedo_font = OpenDiskFont(&speedo_font_attr);
|
||||
|
||||
// Open window on default pubscreen
|
||||
the_window = OpenWindowTags(NULL,
|
||||
WA_Left, 0,
|
||||
WA_Top, 0,
|
||||
WA_InnerWidth, DISPLAY_X,
|
||||
WA_InnerHeight, DISPLAY_Y + 16,
|
||||
WA_Title, (ULONG)"Frodo",
|
||||
WA_ScreenTitle, (ULONG)"Frodo C64 Emulator",
|
||||
WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_MENUPICK | IDCMP_REFRESHWINDOW,
|
||||
WA_DragBar, TRUE,
|
||||
WA_DepthGadget, TRUE,
|
||||
WA_CloseGadget, TRUE,
|
||||
WA_SimpleRefresh, TRUE,
|
||||
WA_Activate, TRUE,
|
||||
WA_NewLookMenus, TRUE,
|
||||
TAG_DONE);
|
||||
the_screen = the_window->WScreen;
|
||||
the_rp = the_window->RPort;
|
||||
xo = the_window->BorderLeft;
|
||||
yo = the_window->BorderTop;
|
||||
|
||||
// Create menus
|
||||
the_visual_info = GetVisualInfo(the_screen, NULL);
|
||||
the_menus = CreateMenus(new_menus, GTMN_FullMenu, TRUE, TAG_DONE);
|
||||
LayoutMenus(the_menus, the_visual_info, GTMN_NewLookMenus, TRUE, TAG_DONE);
|
||||
SetMenuStrip(the_window, the_menus);
|
||||
|
||||
// Obtain 16 pens for the C64 colors
|
||||
for (i=0; i<16; i++)
|
||||
pens[i] = ObtainBestPen(the_screen->ViewPort.ColorMap,
|
||||
palette_red[i] * 0x01010101, palette_green[i] * 0x01010101, palette_blue[i] * 0x01010101);
|
||||
|
||||
// Allocate temporary RastPort for WritePixelArra8()
|
||||
temp_bm = AllocBitMap(DISPLAY_X, 1, 8, 0, NULL);
|
||||
InitRastPort(&temp_rp);
|
||||
temp_rp.BitMap = temp_bm;
|
||||
|
||||
// Draw LED bar
|
||||
draw_led_bar();
|
||||
|
||||
// Allocate file requesters
|
||||
open_req = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_Window, (ULONG)the_window,
|
||||
ASLFR_SleepWindow, TRUE,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Load snapshot...",
|
||||
ASLFR_RejectIcons, TRUE,
|
||||
TAG_DONE);
|
||||
save_req = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_Window, (ULONG)the_window,
|
||||
ASLFR_SleepWindow, TRUE,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Save snapshot...",
|
||||
ASLFR_DoSaveMode, TRUE,
|
||||
ASLFR_RejectIcons, TRUE,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display destructor
|
||||
*/
|
||||
|
||||
C64Display::~C64Display()
|
||||
{
|
||||
// Free file requesters
|
||||
if (open_req != NULL)
|
||||
FreeAslRequest(open_req);
|
||||
if (save_req != NULL)
|
||||
FreeAslRequest(save_req);
|
||||
|
||||
// Free temporary RastPort
|
||||
if (temp_bm != NULL)
|
||||
FreeBitMap(temp_bm);
|
||||
|
||||
// Free pens
|
||||
for (int i=0; i<16; i++)
|
||||
ReleasePen(the_screen->ViewPort.ColorMap, pens[i]);
|
||||
|
||||
// Delete menus
|
||||
if (the_menus != NULL) {
|
||||
if (the_window != NULL)
|
||||
ClearMenuStrip(the_window);
|
||||
FreeMenus(the_menus);
|
||||
}
|
||||
|
||||
// Delete VisualInfo
|
||||
if (the_visual_info != NULL)
|
||||
FreeVisualInfo(the_visual_info);
|
||||
|
||||
// Close window
|
||||
if (the_window != NULL)
|
||||
CloseWindow(the_window);
|
||||
|
||||
// Close fonts
|
||||
CloseFont(speedo_font);
|
||||
CloseFont(led_font);
|
||||
|
||||
// Free chunky buffer
|
||||
delete chunky_buf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prefs may have changed
|
||||
*/
|
||||
|
||||
void C64Display::NewPrefs(Prefs *prefs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redraw bitmap
|
||||
*/
|
||||
|
||||
void C64Display::Update(void)
|
||||
{
|
||||
// Update C64 display
|
||||
WritePixelArray8(the_rp, xo, yo, DISPLAY_X + xo - 1, DISPLAY_Y + yo - 1,
|
||||
chunky_buf, &temp_rp);
|
||||
|
||||
// Update drive LEDs
|
||||
for (int i=0; i<4; i++)
|
||||
if (led_state[i] != old_led_state[i]) {
|
||||
draw_led(i, led_state[i]);
|
||||
old_led_state[i] = led_state[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw LED bar at the bottom of the window
|
||||
*/
|
||||
|
||||
void C64Display::draw_led_bar(void)
|
||||
{
|
||||
int i;
|
||||
char str[16];
|
||||
|
||||
SetAPen(the_rp, pens[15]); // Light gray
|
||||
SetBPen(the_rp, pens[15]); // Light gray
|
||||
RectFill(the_rp, xo, yo+DISPLAY_Y, xo+DISPLAY_X-1, yo+DISPLAY_Y+15);
|
||||
|
||||
SetAPen(the_rp, pens[1]); // White
|
||||
Move(the_rp, xo, yo+DISPLAY_Y); Draw(the_rp, xo+DISPLAY_X-1, yo+DISPLAY_Y);
|
||||
for (i=0; i<5; i++) {
|
||||
Move(the_rp, xo+DISPLAY_X*i/5, yo+DISPLAY_Y); Draw(the_rp, xo+DISPLAY_X*i/5, yo+DISPLAY_Y+14);
|
||||
}
|
||||
for (i=2; i<6; i++) {
|
||||
Move(the_rp, xo+DISPLAY_X*i/5-23, yo+DISPLAY_Y+11); Draw(the_rp, xo+DISPLAY_X*i/5-9, yo+DISPLAY_Y+11);
|
||||
Move(the_rp, xo+DISPLAY_X*i/5-9, yo+DISPLAY_Y+11); Draw(the_rp, xo+DISPLAY_X*i/5-9, yo+DISPLAY_Y+5);
|
||||
}
|
||||
|
||||
SetAPen(the_rp, pens[12]); // Medium gray
|
||||
Move(the_rp, xo, yo+DISPLAY_Y+15); Draw(the_rp, xo+DISPLAY_X-1, yo+DISPLAY_Y+15);
|
||||
for (i=1; i<6; i++) {
|
||||
Move(the_rp, xo+DISPLAY_X*i/5-1, yo+DISPLAY_Y+1); Draw(the_rp, xo+DISPLAY_X*i/5-1, yo+DISPLAY_Y+15);
|
||||
}
|
||||
for (i=2; i<6; i++) {
|
||||
Move(the_rp, xo+DISPLAY_X*i/5-24, yo+DISPLAY_Y+11); Draw(the_rp, xo+DISPLAY_X*i/5-24, yo+DISPLAY_Y+4);
|
||||
Move(the_rp, xo+DISPLAY_X*i/5-24, yo+DISPLAY_Y+4); Draw(the_rp, xo+DISPLAY_X*i/5-9, yo+DISPLAY_Y+4);
|
||||
}
|
||||
|
||||
SetFont(the_rp, led_font);
|
||||
for (i=0; i<4; i++) {
|
||||
sprintf(str, "Drive %d", i+8);
|
||||
SetAPen(the_rp, pens[0]); // Black
|
||||
Move(the_rp, xo+DISPLAY_X*(i+1)/5+8, yo+DISPLAY_Y+11);
|
||||
Text(the_rp, str, strlen(str));
|
||||
draw_led(i, LED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw one LED
|
||||
*/
|
||||
|
||||
void C64Display::draw_led(int num, int state)
|
||||
{
|
||||
switch (state) {
|
||||
case LED_OFF:
|
||||
case LED_ERROR_OFF:
|
||||
SetAPen(the_rp, pens[0]); // Black;
|
||||
break;
|
||||
case LED_ON:
|
||||
SetAPen(the_rp, pens[5]); // Green
|
||||
break;
|
||||
case LED_ERROR_ON:
|
||||
SetAPen(the_rp, pens[2]); // Red
|
||||
break;
|
||||
}
|
||||
RectFill(the_rp, xo+DISPLAY_X*(num+2)/5-23, yo+DISPLAY_Y+5, xo+DISPLAY_X*(num+2)/5-10, yo+DISPLAY_Y+10);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update speedometer
|
||||
*/
|
||||
|
||||
void C64Display::Speedometer(int speed)
|
||||
{
|
||||
static int delay = 0;
|
||||
|
||||
if (delay >= 20) {
|
||||
char str[16];
|
||||
sprintf(str, "%d%%", speed);
|
||||
SetAPen(the_rp, pens[15]); // Light gray
|
||||
RectFill(the_rp, xo+1, yo+DISPLAY_Y+1, xo+DISPLAY_X/5-2, yo+DISPLAY_Y+14);
|
||||
SetAPen(the_rp, pens[0]); // Black
|
||||
SetFont(the_rp, speedo_font);
|
||||
Move(the_rp, xo+24, yo+DISPLAY_Y+10);
|
||||
Text(the_rp, str, strlen(str));
|
||||
delay = 0;
|
||||
} else
|
||||
delay++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return pointer to bitmap data
|
||||
*/
|
||||
|
||||
UBYTE *C64Display::BitmapBase(void)
|
||||
{
|
||||
return chunky_buf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return number of bytes per row
|
||||
*/
|
||||
|
||||
int C64Display::BitmapXMod(void)
|
||||
{
|
||||
return DISPLAY_X;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle IDCMP messages
|
||||
*/
|
||||
|
||||
void C64Display::PollKeyboard(UBYTE *key_matrix, UBYTE *rev_matrix, UBYTE *joystick)
|
||||
{
|
||||
struct IntuiMessage *msg;
|
||||
|
||||
// Get and analyze all pending window messages
|
||||
while ((msg = (struct IntuiMessage *)GetMsg(the_window->UserPort)) != NULL) {
|
||||
|
||||
// Extract data and reply message
|
||||
ULONG iclass = msg->Class;
|
||||
USHORT code = msg->Code;
|
||||
ReplyMsg((struct Message *)msg);
|
||||
|
||||
// Action depends on message class
|
||||
switch (iclass) {
|
||||
|
||||
case IDCMP_CLOSEWINDOW: // Closing the window quits Frodo
|
||||
TheC64->Quit();
|
||||
break;
|
||||
|
||||
case IDCMP_RAWKEY:
|
||||
switch (code) {
|
||||
|
||||
case 0x58: // F9: NMI (Restore)
|
||||
TheC64->NMI();
|
||||
break;
|
||||
|
||||
case 0x59: // F10: Reset
|
||||
TheC64->Reset();
|
||||
break;
|
||||
|
||||
case 0x5e: // '+' on keypad: Increase SkipFrames
|
||||
ThePrefs.SkipFrames++;
|
||||
break;
|
||||
|
||||
case 0x4a: // '-' on keypad: Decrease SkipFrames
|
||||
if (ThePrefs.SkipFrames > 1)
|
||||
ThePrefs.SkipFrames--;
|
||||
break;
|
||||
|
||||
case 0x5d: // '*' on keypad: Toggle speed limiter
|
||||
ThePrefs.LimitSpeed = !ThePrefs.LimitSpeed;
|
||||
break;
|
||||
|
||||
case 0x5c:{ // '/' on keypad: Toggle processor-level 1541 emulation
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
prefs->Emul1541Proc = !prefs->Emul1541Proc;
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
delete prefs;
|
||||
break;
|
||||
}
|
||||
|
||||
default:{
|
||||
// Convert Amiga keycode to C64 row/column
|
||||
int c64_byte = key_byte[code & 0x7f];
|
||||
int c64_bit = key_bit[code & 0x7f];
|
||||
|
||||
if (c64_byte != -1) {
|
||||
if (!(c64_byte & 0x20)) {
|
||||
|
||||
// Normal keys
|
||||
bool shifted = c64_byte & 8;
|
||||
c64_byte &= 7;
|
||||
if (!(code & 0x80)) {
|
||||
|
||||
// Key pressed
|
||||
if (shifted) {
|
||||
key_matrix[6] &= 0xef;
|
||||
rev_matrix[4] &= 0xbf;
|
||||
}
|
||||
key_matrix[c64_byte] &= ~(1 << c64_bit);
|
||||
rev_matrix[c64_bit] &= ~(1 << c64_byte);
|
||||
} else {
|
||||
|
||||
// Key released
|
||||
if (shifted) {
|
||||
key_matrix[6] |= 0x10;
|
||||
rev_matrix[4] |= 0x40;
|
||||
}
|
||||
key_matrix[c64_byte] |= (1 << c64_bit);
|
||||
rev_matrix[c64_bit] |= (1 << c64_byte);
|
||||
}
|
||||
} else {
|
||||
|
||||
// Joystick emulation
|
||||
c64_byte &= 0x1f;
|
||||
if (code & 0x80)
|
||||
*joystick |= c64_byte;
|
||||
else
|
||||
*joystick &= ~c64_byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDCMP_MENUPICK:{
|
||||
if (code == MENUNULL)
|
||||
break;
|
||||
|
||||
// Get item number
|
||||
int item_number = ITEMNUM(code);
|
||||
switch (item_number) {
|
||||
|
||||
case 0: { // About Frodo
|
||||
TheC64->Pause();
|
||||
char str[256];
|
||||
sprintf(str, "%s by Christian Bauer\n<Christian.Bauer@uni-mainz.de>\n© Copyright 1994-1997,2002-2005", VERSION_STRING);
|
||||
ShowRequester(str, "OK");
|
||||
TheC64->Resume();
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // Preferences
|
||||
TheC64->Pause();
|
||||
be_app->RunPrefsEditor();
|
||||
TheC64->Resume();
|
||||
break;
|
||||
|
||||
case 4: // Reset C64
|
||||
TheC64->Reset();
|
||||
break;
|
||||
|
||||
case 5: // Insert next disk
|
||||
if (strlen(ThePrefs.DrivePath[0]) > 4) {
|
||||
char str[256];
|
||||
strcpy(str, ThePrefs.DrivePath[0]);
|
||||
char *p = str + strlen(str) - 5;
|
||||
|
||||
// If path matches "*.?64", increment character before the '.'
|
||||
if (p[1] == '.' && p[3] == '6' && p[4] == '4') {
|
||||
p[0]++;
|
||||
|
||||
// If no such file exists, set character before the '.' to '1', 'a' or 'A'
|
||||
FILE *file;
|
||||
if ((file = fopen(str, "rb")) == NULL) {
|
||||
if (isdigit(p[0]))
|
||||
p[0] = '1';
|
||||
else if (isupper(p[0]))
|
||||
p[0] = 'A';
|
||||
else
|
||||
p[0] = 'a';
|
||||
} else
|
||||
fclose(file);
|
||||
|
||||
// Set new prefs
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
strcpy(prefs->DrivePath[0], str);
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
delete prefs;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // SAM
|
||||
TheC64->Pause();
|
||||
SAM(TheC64);
|
||||
TheC64->Resume();
|
||||
break;
|
||||
|
||||
case 8: // Load snapshot
|
||||
if (open_req != NULL && AslRequest(open_req, NULL)) {
|
||||
char path[256];
|
||||
strncpy(path, open_req->fr_Drawer, 255);
|
||||
AddPart(path, open_req->fr_File, 255);
|
||||
TheC64->Pause();
|
||||
TheC64->LoadSnapshot(path);
|
||||
TheC64->Resume();
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // Save snapshot
|
||||
if (save_req != NULL && AslRequest(save_req, NULL)) {
|
||||
char path[256];
|
||||
strncpy(path, save_req->fr_Drawer, 255);
|
||||
AddPart(path, save_req->fr_File, 255);
|
||||
TheC64->Pause();
|
||||
TheC64->SaveSnapshot(path);
|
||||
TheC64->Resume();
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: // Quit Frodo
|
||||
TheC64->Quit();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IDCMP_REFRESHWINDOW:
|
||||
BeginRefresh(the_window);
|
||||
draw_led_bar();
|
||||
EndRefresh(the_window, TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check if NumLock is down (for switching the joystick keyboard emulation)
|
||||
*/
|
||||
|
||||
bool C64Display::NumLock(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate C64 colors
|
||||
*/
|
||||
|
||||
void C64Display::InitColors(UBYTE *colors)
|
||||
{
|
||||
// Spread pens into colors array
|
||||
for (int i=0; i<256; i++)
|
||||
colors[i] = pens[i & 0x0f];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a requester
|
||||
*/
|
||||
|
||||
long ShowRequester(const char *str, const char *button1, const char *button2)
|
||||
{
|
||||
struct EasyStruct es;
|
||||
char gads[256];
|
||||
|
||||
strcpy(gads, button1);
|
||||
if (button2) {
|
||||
strcat(gads, "|");
|
||||
strcat(gads, button2);
|
||||
}
|
||||
|
||||
es.es_StructSize = sizeof(struct EasyStruct);
|
||||
es.es_Flags = 0;
|
||||
es.es_Title = "Frodo";
|
||||
es.es_TextFormat = str;
|
||||
es.es_GadgetFormat = gads;
|
||||
|
||||
return EasyRequestArgs(NULL, &es, NULL, NULL) % 1;
|
||||
}
|
@ -1,961 +0,0 @@
|
||||
/*
|
||||
* DisplayEmbeddedSDL.h - C64 graphics display, emulator window handling
|
||||
* for embedded Linux devices (Qtopia, Maemo)
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2009 Christian Bauer
|
||||
* Changes for embedded Linux devices (Qtopia, Maemo) (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "C64.h"
|
||||
#include "SAM.h"
|
||||
#include "main.h"
|
||||
#include "Version.h"
|
||||
|
||||
#include "sdlgui.h"
|
||||
#include "dlgMain.h"
|
||||
|
||||
#define QWS
|
||||
#include <SDL.h>
|
||||
#include <SDL_thread.h>
|
||||
|
||||
// Display surface
|
||||
static SDL_Surface *screen = 0;
|
||||
static SDL_Surface *backgroundSurf = 0;
|
||||
static SDL_Surface *surf = 0;
|
||||
|
||||
static SDL_mutex *screenLock = 0;
|
||||
|
||||
// Mode of Joystick emulation. 0 = none, 1 = Joyport 1, 2 = Joyport 2
|
||||
static short joy_emu = 0;
|
||||
|
||||
// Keyboard
|
||||
static bool tab_pressed = false;
|
||||
|
||||
// For LED error blinking
|
||||
static C64Display *c64_disp;
|
||||
static struct sigaction pulse_sa;
|
||||
static itimerval pulse_tv;
|
||||
|
||||
// SDL joysticks
|
||||
static SDL_Joystick *joy[2] = {NULL, NULL};
|
||||
|
||||
// Colors for speedometer/drive LEDs
|
||||
enum
|
||||
{
|
||||
black = 0,
|
||||
white = 1,
|
||||
fill_gray = 16,
|
||||
shine_gray = 17,
|
||||
shadow_gray = 18,
|
||||
red = 19,
|
||||
green = 20,
|
||||
PALETTE_SIZE = 21
|
||||
};
|
||||
|
||||
/*
|
||||
C64 keyboard matrix:
|
||||
|
||||
Bit 7 6 5 4 3 2 1 0
|
||||
0 CUD F5 F3 F1 F7 CLR RET DEL
|
||||
1 SHL E S Z 4 A W 3
|
||||
2 X T F C 6 D R 5
|
||||
3 V U H B 8 G Y 7
|
||||
4 N O K M 0 J I 9
|
||||
5 , @ : . - L P +
|
||||
6 / ^ = SHR HOM ; *
|
||||
7 R/S Q C= SPC 2 CTL <- 1
|
||||
*/
|
||||
|
||||
#define MATRIX(a,b) (((a) << 3) | (b))
|
||||
|
||||
|
||||
/*
|
||||
* Open window
|
||||
*/
|
||||
|
||||
char *buffer;
|
||||
|
||||
int width = 320;
|
||||
int height = 240;
|
||||
|
||||
bool isGuiAvailable = true; // TODO from main.cpp
|
||||
bool GUIOpened = false;
|
||||
|
||||
static SDL_Thread *GUIthread = NULL;
|
||||
static const int GUI_RETURN_INFO = (SDL_USEREVENT+1);
|
||||
static bool doUpdate = true;
|
||||
|
||||
void update( int32 x, int32 y, int32 w, int32 h, bool forced )
|
||||
{
|
||||
if ( !forced && !doUpdate ) // the HW surface is available
|
||||
return;
|
||||
|
||||
// SDL_UpdateRect(SDL_GetVideoSurface(), 0, 0, width, height);
|
||||
// SDL_UpdateRect(surf, x, y, w, h);
|
||||
SDL_UpdateRect(screen, x, y, w, h);
|
||||
}
|
||||
|
||||
void update( bool forced )
|
||||
{
|
||||
update( 0, 0, width, height, forced );
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
update( 0, 0, width, height, false );
|
||||
}
|
||||
|
||||
void restoreBackground()
|
||||
{
|
||||
if (backgroundSurf != NULL) {
|
||||
SDL_BlitSurface(backgroundSurf, NULL, screen, NULL);
|
||||
update(true);
|
||||
fprintf(stderr, "video surface restored\n");
|
||||
}
|
||||
}
|
||||
|
||||
void allocateBackgroundSurf()
|
||||
{
|
||||
// allocate new background video surface
|
||||
backgroundSurf = SDL_ConvertSurface(screen, screen->format, screen->flags);
|
||||
fprintf(stderr, "Allocating background video surface\n");
|
||||
}
|
||||
|
||||
void freeBackgroundSurf()
|
||||
{
|
||||
// free background video surface
|
||||
if (backgroundSurf != NULL)
|
||||
{
|
||||
fprintf(stderr, "Freeing background video surface\n");
|
||||
SDL_FreeSurface(backgroundSurf);
|
||||
backgroundSurf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void openGUI()
|
||||
{
|
||||
fprintf(stderr, "open GUI\n");
|
||||
if (GUIOpened)
|
||||
{
|
||||
fprintf(stderr, "GUI is already open!\n");
|
||||
return;
|
||||
}
|
||||
allocateBackgroundSurf();
|
||||
surf = backgroundSurf;
|
||||
GUIOpened = true;
|
||||
}
|
||||
|
||||
void closeGUI()
|
||||
{
|
||||
fprintf(stderr, "close GUI\n");
|
||||
// update the main surface and then redirect VDI to it
|
||||
restoreBackground();
|
||||
surf = screen; // redirect VDI to main surface
|
||||
fprintf(stderr, "VDI redirected back to main video surface\n");
|
||||
freeBackgroundSurf();
|
||||
GUIOpened = false;
|
||||
}
|
||||
|
||||
void saveBackground()
|
||||
{
|
||||
if (backgroundSurf != NULL) {
|
||||
SDL_BlitSurface(screen, NULL, backgroundSurf, NULL);
|
||||
surf = backgroundSurf; // redirect VDI to background surface
|
||||
fprintf(stderr, "video surface saved to background, VDI redirected\n");
|
||||
}
|
||||
}
|
||||
|
||||
void blendBackgrounds()
|
||||
{
|
||||
if (backgroundSurf != NULL)
|
||||
{
|
||||
SDL_Rect *Rect;
|
||||
Rect = SDLGui_GetFirstBackgroundRect();
|
||||
while (Rect != NULL)
|
||||
{
|
||||
SDL_BlitSurface(backgroundSurf, Rect, screen, Rect);
|
||||
Rect = SDLGui_GetNextBackgroundRect();
|
||||
}
|
||||
update(true);
|
||||
}
|
||||
}
|
||||
|
||||
static Prefs DialogPrefs;
|
||||
|
||||
// running in a different thread
|
||||
static int open_gui(void * /*ptr*/)
|
||||
{
|
||||
openGUI();
|
||||
DialogPrefs = ThePrefs;
|
||||
// Show main dialog
|
||||
int status = Dialog_Main(DialogPrefs);
|
||||
// The status is sent to event checking thread by the USEREVENT+1 message
|
||||
SDL_Event ev;
|
||||
ev.type = GUI_RETURN_INFO;
|
||||
ev.user.code = status; // STATUS_SHUTDOWN or STATUS_REBOOT
|
||||
ev.user.data1 = NULL;
|
||||
SDL_PeepEvents(&ev, 1, SDL_ADDEVENT, SDL_EVENTMASK(GUI_RETURN_INFO));
|
||||
closeGUI();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool start_GUI_thread()
|
||||
{
|
||||
if (isGuiAvailable) // TODO && !hostScreen.isGUIopen())
|
||||
{
|
||||
GUIthread = SDL_CreateThread(open_gui, NULL);
|
||||
}
|
||||
return (GUIthread != NULL);
|
||||
}
|
||||
|
||||
void kill_GUI_thread()
|
||||
{
|
||||
if (GUIthread != NULL) {
|
||||
SDL_KillThread(GUIthread);
|
||||
GUIthread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void screenlock()
|
||||
{
|
||||
while (SDL_mutexP(screenLock)==-1)
|
||||
{
|
||||
SDL_Delay(20);
|
||||
fprintf(stderr, "Couldn't lock mutex\n");
|
||||
}
|
||||
}
|
||||
|
||||
void screenunlock()
|
||||
{
|
||||
while (SDL_mutexV(screenLock)==-1)
|
||||
{
|
||||
SDL_Delay(20);
|
||||
fprintf(stderr, "Couldn't unlock mutex\n");
|
||||
}
|
||||
}
|
||||
|
||||
int init_graphics(void)
|
||||
{
|
||||
// Init SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
screenLock = SDL_CreateMutex();
|
||||
|
||||
buffer = new char[DISPLAY_X*DISPLAY_Y];
|
||||
// Open window
|
||||
SDL_WM_SetCaption(VERSION_STRING, "Frodo");
|
||||
screen = SDL_SetVideoMode(320, 240, 8, SDL_DOUBLEBUF);
|
||||
surf = screen;
|
||||
if (screen == NULL)
|
||||
{
|
||||
fprintf(stderr, "SDL Couldn't set video mode to %d x %d\n", DISPLAY_X, DISPLAY_Y+17);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "SDL Set video mode to %d x %d\n", DISPLAY_X, DISPLAY_Y+17);
|
||||
SDLGui_Init(screen);
|
||||
start_GUI_thread();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Display constructor
|
||||
*/
|
||||
|
||||
C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
{
|
||||
quit_requested = false;
|
||||
speedometer_string[0] = 0;
|
||||
|
||||
// LEDs off
|
||||
for (int i=0; i<4; i++)
|
||||
led_state[i] = old_led_state[i] = LED_OFF;
|
||||
|
||||
// Start timer for LED error blinking
|
||||
c64_disp = this;
|
||||
pulse_sa.sa_handler = (void (*)(int))pulse_handler;
|
||||
pulse_sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&pulse_sa.sa_mask);
|
||||
sigaction(SIGALRM, &pulse_sa, NULL);
|
||||
pulse_tv.it_interval.tv_sec = 0;
|
||||
pulse_tv.it_interval.tv_usec = 400000;
|
||||
pulse_tv.it_value.tv_sec = 0;
|
||||
pulse_tv.it_value.tv_usec = 400000;
|
||||
setitimer(ITIMER_REAL, &pulse_tv, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display destructor
|
||||
*/
|
||||
|
||||
C64Display::~C64Display()
|
||||
{
|
||||
SDL_Quit();
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prefs may have changed
|
||||
*/
|
||||
|
||||
void C64Display::NewPrefs(Prefs *prefs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redraw bitmap
|
||||
*/
|
||||
|
||||
void C64Display::Update(void)
|
||||
{
|
||||
screenlock();
|
||||
if (surf == NULL)
|
||||
return;
|
||||
int iOffsetX = (DISPLAY_X - surf->w) / 2;
|
||||
int iOffsetY = (DISPLAY_Y - surf->h) / 2;
|
||||
for (int j=0; j < surf->h - 17; j++)
|
||||
{
|
||||
memcpy(static_cast<char*>(surf->pixels)+surf->w*j, buffer+iOffsetX+DISPLAY_X*(j+iOffsetY), surf->w);
|
||||
}
|
||||
// Draw speedometer/LEDs
|
||||
SDL_Rect r = {0, (surf->h - 17), DISPLAY_X, 15};
|
||||
SDL_FillRect(surf, &r, fill_gray);
|
||||
r.w = DISPLAY_X; r.h = 1;
|
||||
SDL_FillRect(surf, &r, shine_gray);
|
||||
r.y = (surf->h - 17) + 14;
|
||||
SDL_FillRect(surf, &r, shadow_gray);
|
||||
r.w = 16;
|
||||
for (int i=2; i<5; i++)
|
||||
{
|
||||
r.x = DISPLAY_X * i/5 - 24; r.y = (surf->h - 17) + 4;
|
||||
SDL_FillRect(surf, &r, shadow_gray);
|
||||
r.y = (surf->h - 17) + 10;
|
||||
SDL_FillRect(surf, &r, shine_gray);
|
||||
}
|
||||
r.y = (surf->h - 17); r.w = 1; r.h = 15;
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
r.x = DISPLAY_X * i / 5;
|
||||
SDL_FillRect(surf, &r, shine_gray);
|
||||
r.x = DISPLAY_X * (i+1) / 5 - 1;
|
||||
SDL_FillRect(surf, &r, shadow_gray);
|
||||
}
|
||||
r.y = (surf->h - 17) + 4; r.h = 7;
|
||||
for (int i=2; i<5; i++)
|
||||
{
|
||||
r.x = DISPLAY_X * i/5 - 24;
|
||||
SDL_FillRect(surf, &r, shadow_gray);
|
||||
r.x = DISPLAY_X * i/5 - 9;
|
||||
SDL_FillRect(surf, &r, shine_gray);
|
||||
}
|
||||
r.y = (surf->h - 17) + 5; r.w = 14; r.h = 5;
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
r.x = DISPLAY_X * (i+2) / 5 - 23;
|
||||
int c;
|
||||
switch (led_state[i])
|
||||
{
|
||||
case LED_ON:
|
||||
c = green;
|
||||
break;
|
||||
case LED_ERROR_ON:
|
||||
c = red;
|
||||
break;
|
||||
default:
|
||||
c = black;
|
||||
break;
|
||||
}
|
||||
SDL_FillRect(surf, &r, c);
|
||||
}
|
||||
|
||||
draw_string(surf, DISPLAY_X * 1/5 + 8, (surf->h - 17) + 4, "D\x12 8", black, fill_gray);
|
||||
draw_string(surf, DISPLAY_X * 2/5 + 8, (surf->h - 17) + 4, "D\x12 9", black, fill_gray);
|
||||
draw_string(surf, DISPLAY_X * 3/5 + 8, (surf->h - 17) + 4, "D\x12 10", black, fill_gray);
|
||||
if (joy_emu == 1)
|
||||
draw_string(surf, DISPLAY_X * 4/5 + 2, (surf->h - 17) + 4, "1", black, fill_gray);
|
||||
else if (joy_emu == 2)
|
||||
draw_string(surf, DISPLAY_X * 4/5 + 2, (surf->h - 17) + 4, "2", black, fill_gray);
|
||||
draw_string(surf, 24, (surf->h - 17) + 4, speedometer_string, black, fill_gray);
|
||||
|
||||
// Update display
|
||||
SDL_Flip(surf);
|
||||
|
||||
blendBackgrounds();
|
||||
screenunlock();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw string into surface using the C64 ROM font
|
||||
*/
|
||||
|
||||
void C64Display::draw_string(SDL_Surface *s, int x, int y, const char *str, uint8 front_color, uint8 back_color)
|
||||
{
|
||||
uint8 *pb = (uint8 *)s->pixels + s->pitch*y + x;
|
||||
char c;
|
||||
while ((c = *str++) != 0)
|
||||
{
|
||||
uint8 *q = TheC64->Char + c*8 + 0x800;
|
||||
uint8 *p = pb;
|
||||
for (int y=0; y<8; y++)
|
||||
{
|
||||
uint8 v = *q++;
|
||||
p[0] = (v & 0x80) ? front_color : back_color;
|
||||
p[1] = (v & 0x40) ? front_color : back_color;
|
||||
p[2] = (v & 0x20) ? front_color : back_color;
|
||||
p[3] = (v & 0x10) ? front_color : back_color;
|
||||
p[4] = (v & 0x08) ? front_color : back_color;
|
||||
p[5] = (v & 0x04) ? front_color : back_color;
|
||||
p[6] = (v & 0x02) ? front_color : back_color;
|
||||
p[7] = (v & 0x01) ? front_color : back_color;
|
||||
p += s->pitch;
|
||||
}
|
||||
pb += 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* LED error blink
|
||||
*/
|
||||
|
||||
void C64Display::pulse_handler(...)
|
||||
{
|
||||
for (int i=0; i<4; i++)
|
||||
switch (c64_disp->led_state[i])
|
||||
{
|
||||
case LED_ERROR_ON:
|
||||
c64_disp->led_state[i] = LED_ERROR_OFF;
|
||||
break;
|
||||
case LED_ERROR_OFF:
|
||||
c64_disp->led_state[i] = LED_ERROR_ON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw speedometer
|
||||
*/
|
||||
|
||||
void C64Display::Speedometer(int speed)
|
||||
{
|
||||
static int delay = 0;
|
||||
|
||||
if (delay >= 20)
|
||||
{
|
||||
delay = 0;
|
||||
sprintf(speedometer_string, "%d%%", speed);
|
||||
}
|
||||
else
|
||||
delay++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return pointer to bitmap data
|
||||
*/
|
||||
|
||||
uint8 *C64Display::BitmapBase(void)
|
||||
{
|
||||
//return (uint8 *)screen->pixels;
|
||||
return (uint8 *)buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return number of bytes per row
|
||||
*/
|
||||
|
||||
int C64Display::BitmapXMod(void)
|
||||
{
|
||||
//return screen->pitch;
|
||||
return DISPLAY_X;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Poll the keyboard
|
||||
*/
|
||||
|
||||
static void translate_key(SDLKey key, bool key_up, uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||
{
|
||||
int c64_key = -1;
|
||||
if (tab_pressed)
|
||||
{
|
||||
// Function and run/stop key emulation on Zaurus keyboard
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_q: c64_key = MATRIX(0,4); break;
|
||||
case SDLK_w: c64_key = MATRIX(0,4) | 0x80; break;
|
||||
case SDLK_e: c64_key = MATRIX(0,5); break;
|
||||
case SDLK_r: c64_key = MATRIX(0,5) | 0x80; break;
|
||||
case SDLK_t: c64_key = MATRIX(0,6); break;
|
||||
case SDLK_z: c64_key = MATRIX(0,6) | 0x80; break;
|
||||
case SDLK_u: c64_key = MATRIX(0,3); break;
|
||||
case SDLK_i: c64_key = MATRIX(0,3) | 0x80; break;
|
||||
case SDLK_o: c64_key = MATRIX(7,7); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_a: c64_key = MATRIX(1,2); break;
|
||||
case SDLK_b: c64_key = MATRIX(3,4); break;
|
||||
case SDLK_c: c64_key = MATRIX(2,4); break;
|
||||
case SDLK_d: c64_key = MATRIX(2,2); break;
|
||||
case SDLK_e: c64_key = MATRIX(1,6); break;
|
||||
case SDLK_f: c64_key = MATRIX(2,5); break;
|
||||
case SDLK_g: c64_key = MATRIX(3,2); break;
|
||||
case SDLK_h: c64_key = MATRIX(3,5); break;
|
||||
case SDLK_i: c64_key = MATRIX(4,1); break;
|
||||
case SDLK_j: c64_key = MATRIX(4,2); break;
|
||||
case SDLK_k: c64_key = MATRIX(4,5); break;
|
||||
case SDLK_l: c64_key = MATRIX(5,2); break;
|
||||
case SDLK_m: c64_key = MATRIX(4,4); break;
|
||||
case SDLK_n: c64_key = MATRIX(4,7); break;
|
||||
case SDLK_o: c64_key = MATRIX(4,6); break;
|
||||
case SDLK_p: c64_key = MATRIX(5,1); break;
|
||||
case SDLK_q: c64_key = MATRIX(7,6); break;
|
||||
case SDLK_r: c64_key = MATRIX(2,1); break;
|
||||
case SDLK_s: c64_key = MATRIX(1,5); break;
|
||||
case SDLK_t: c64_key = MATRIX(2,6); break;
|
||||
case SDLK_u: c64_key = MATRIX(3,6); break;
|
||||
case SDLK_v: c64_key = MATRIX(3,7); break;
|
||||
case SDLK_w: c64_key = MATRIX(1,1); break;
|
||||
case SDLK_x: c64_key = MATRIX(2,7); break;
|
||||
case SDLK_y: c64_key = MATRIX(3,1); break;
|
||||
case SDLK_z: c64_key = MATRIX(1,4); break;
|
||||
|
||||
case SDLK_0: c64_key = MATRIX(4,3); break;
|
||||
case SDLK_1: c64_key = MATRIX(7,0); break;
|
||||
case SDLK_2: c64_key = MATRIX(7,3); break;
|
||||
case SDLK_3: c64_key = MATRIX(1,0); break;
|
||||
case SDLK_4: c64_key = MATRIX(1,3); break;
|
||||
case SDLK_5: c64_key = MATRIX(2,0); break;
|
||||
case SDLK_6: c64_key = MATRIX(2,3); break;
|
||||
case SDLK_7: c64_key = MATRIX(3,0); break;
|
||||
case SDLK_8: c64_key = MATRIX(3,3); break;
|
||||
case SDLK_9: c64_key = MATRIX(4,0); break;
|
||||
|
||||
case SDLK_SPACE: c64_key = MATRIX(7,4); break;
|
||||
case SDLK_BACKQUOTE: c64_key = MATRIX(7,1); break;
|
||||
case SDLK_BACKSLASH: c64_key = MATRIX(6,6); break;
|
||||
case SDLK_COMMA: c64_key = MATRIX(5,7); break;
|
||||
case SDLK_PERIOD: c64_key = MATRIX(5,4); break;
|
||||
case SDLK_MINUS: c64_key = MATRIX(5,0); break;
|
||||
case SDLK_EQUALS: c64_key = MATRIX(5,3); break;
|
||||
case SDLK_LEFTBRACKET: c64_key = MATRIX(5,6); break;
|
||||
case SDLK_RIGHTBRACKET: c64_key = MATRIX(6,1); break;
|
||||
case SDLK_SEMICOLON: c64_key = MATRIX(5,5); break;
|
||||
case SDLK_QUOTE: c64_key = MATRIX(6,2); break;
|
||||
case SDLK_SLASH: c64_key = MATRIX(6,7); break;
|
||||
|
||||
case SDLK_ESCAPE: c64_key = MATRIX(7,7); break;
|
||||
case SDLK_RETURN: c64_key = MATRIX(0,1); break;
|
||||
case SDLK_BACKSPACE: case SDLK_DELETE: c64_key = MATRIX(0,0); break;
|
||||
case SDLK_INSERT: c64_key = MATRIX(6,3); break;
|
||||
case SDLK_HOME: c64_key = MATRIX(6,3); break;
|
||||
case SDLK_END: c64_key = MATRIX(6,0); break;
|
||||
case SDLK_PAGEUP: c64_key = MATRIX(6,0); break;
|
||||
case SDLK_PAGEDOWN: c64_key = MATRIX(6,5); break;
|
||||
|
||||
case SDLK_LCTRL: c64_key = MATRIX(7,2); break;
|
||||
case SDLK_RCTRL: c64_key = MATRIX(7,5); break;
|
||||
case SDLK_LSHIFT: c64_key = MATRIX(1,7); break;
|
||||
case SDLK_RSHIFT: c64_key = MATRIX(6,4); break;
|
||||
case SDLK_LALT: case SDLK_LMETA: c64_key = MATRIX(7,5); break;
|
||||
case SDLK_RALT: case SDLK_RMETA: c64_key = MATRIX(7,5); break;
|
||||
|
||||
case SDLK_UP: c64_key = MATRIX(0,7)| 0x80; break;
|
||||
case SDLK_DOWN: c64_key = MATRIX(0,7); break;
|
||||
case SDLK_LEFT: c64_key = MATRIX(0,2) | 0x80; break;
|
||||
case SDLK_RIGHT: c64_key = MATRIX(0,2); break;
|
||||
|
||||
case SDLK_F1: c64_key = MATRIX(0,4); break;
|
||||
case SDLK_F2: c64_key = MATRIX(0,4) | 0x80; break;
|
||||
case SDLK_F3: c64_key = MATRIX(0,5); break;
|
||||
case SDLK_F4: c64_key = MATRIX(0,5) | 0x80; break;
|
||||
case SDLK_F5: c64_key = MATRIX(0,6); break;
|
||||
case SDLK_F6: c64_key = MATRIX(0,6) | 0x80; break;
|
||||
case SDLK_F7: c64_key = MATRIX(0,3); break;
|
||||
case SDLK_F8: c64_key = MATRIX(0,3) | 0x80; break;
|
||||
|
||||
case SDLK_KP0: case SDLK_KP5: c64_key = 0x10 | 0x40; break;
|
||||
case SDLK_KP1: c64_key = 0x06 | 0x40; break;
|
||||
case SDLK_KP2: c64_key = 0x02 | 0x40; break;
|
||||
case SDLK_KP3: c64_key = 0x0a | 0x40; break;
|
||||
case SDLK_KP4: c64_key = 0x04 | 0x40; break;
|
||||
case SDLK_KP6: c64_key = 0x08 | 0x40; break;
|
||||
case SDLK_KP7: c64_key = 0x05 | 0x40; break;
|
||||
case SDLK_KP8: c64_key = 0x01 | 0x40; break;
|
||||
case SDLK_KP9: c64_key = 0x09 | 0x40; break;
|
||||
|
||||
case SDLK_KP_DIVIDE: c64_key = MATRIX(6,7); break;
|
||||
case SDLK_KP_ENTER: c64_key = MATRIX(0,1); break;
|
||||
|
||||
// Support for Zaurus/Qtopia
|
||||
case SDLK_QUOTEDBL: c64_key = MATRIX(7,3) | 0x80; break;
|
||||
case SDLK_ASTERISK: c64_key = MATRIX(6,1); break;
|
||||
case SDLK_DOLLAR: c64_key = MATRIX(1,3) | 0x80; break;
|
||||
case SDLK_COLON: c64_key = MATRIX(5,5); break;
|
||||
case SDLK_AT: c64_key = MATRIX(5,6); break;
|
||||
}
|
||||
}
|
||||
if (c64_key < 0)
|
||||
return;
|
||||
|
||||
// Zaurus/Qtopia joystick emulation
|
||||
if (joy_emu != 0)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_SPACE: c64_key = 0x10 | 0x40; break;
|
||||
case SDLK_UP: c64_key = 0x01 | 0x40; break;
|
||||
case SDLK_DOWN: c64_key = 0x02 | 0x40; break;
|
||||
case SDLK_LEFT: c64_key = 0x04 | 0x40; break;
|
||||
case SDLK_RIGHT: c64_key = 0x08 | 0x40; break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle joystick emulation
|
||||
if (c64_key & 0x40)
|
||||
{
|
||||
c64_key &= 0x1f;
|
||||
if (key_up)
|
||||
*joystick |= c64_key;
|
||||
else
|
||||
*joystick &= ~c64_key;
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle other keys
|
||||
bool shifted = c64_key & 0x80;
|
||||
int c64_byte = (c64_key >> 3) & 7;
|
||||
int c64_bit = c64_key & 7;
|
||||
if (key_up)
|
||||
{
|
||||
if (shifted)
|
||||
{
|
||||
key_matrix[6] |= 0x10;
|
||||
rev_matrix[4] |= 0x40;
|
||||
}
|
||||
key_matrix[c64_byte] |= (1 << c64_bit);
|
||||
rev_matrix[c64_bit] |= (1 << c64_byte);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shifted)
|
||||
{
|
||||
key_matrix[6] &= 0xef;
|
||||
rev_matrix[4] &= 0xbf;
|
||||
}
|
||||
key_matrix[c64_byte] &= ~(1 << c64_bit);
|
||||
rev_matrix[c64_bit] &= ~(1 << c64_byte);
|
||||
}
|
||||
}
|
||||
|
||||
void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||
{
|
||||
SDL_Event event;
|
||||
int eventmask = SDL_EVENTMASK(SDL_KEYDOWN)
|
||||
| SDL_EVENTMASK(SDL_KEYUP)
|
||||
| SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)
|
||||
| SDL_EVENTMASK(SDL_MOUSEBUTTONUP)
|
||||
| SDL_EVENTMASK(SDL_MOUSEMOTION)
|
||||
| SDL_EVENTMASK(SDL_JOYAXISMOTION)
|
||||
| SDL_EVENTMASK(SDL_JOYHATMOTION)
|
||||
| SDL_EVENTMASK(SDL_JOYBUTTONDOWN)
|
||||
| SDL_EVENTMASK(SDL_JOYBUTTONUP)
|
||||
| SDL_EVENTMASK(SDL_ACTIVEEVENT)
|
||||
| SDL_EVENTMASK(GUI_RETURN_INFO)
|
||||
| SDL_EVENTMASK(SDL_QUIT);
|
||||
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, eventmask))
|
||||
{
|
||||
if (GUIOpened)
|
||||
{
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP)
|
||||
{
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN)
|
||||
fprintf(stderr, "Mouse down\n");
|
||||
if (event.type == SDL_MOUSEBUTTONUP)
|
||||
fprintf(stderr, "Mouse up\n");
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_USEREVENT; // map button down/up to user event
|
||||
ev.user.code = event.type;
|
||||
ev.user.data1 = (void *)(int)event.button.x;
|
||||
ev.user.data2 = (void *)(int)event.button.y;
|
||||
SDL_PeepEvents(&ev, 1, SDL_ADDEVENT, SDL_EVENTMASK(SDL_USEREVENT));
|
||||
}
|
||||
else if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
|
||||
{
|
||||
if (event.type == SDL_KEYDOWN)
|
||||
fprintf(stderr, "Key down\n");
|
||||
if (event.type == SDL_KEYUP)
|
||||
fprintf(stderr, "Key up\n");
|
||||
SDLKey sym = event.key.keysym.sym;
|
||||
int state = SDL_GetModState(); // keysym.mod does not deliver single mod key presses for
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_USEREVENT; // map key down/up event to user event
|
||||
ev.user.code = event.type;
|
||||
ev.user.data1 = (void *)(int)sym;
|
||||
ev.user.data2 = (void *)(int)state;
|
||||
SDL_PeepEvents(&ev, 1, SDL_ADDEVENT, SDL_EVENTMASK(SDL_USEREVENT));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
case GUI_RETURN_INFO:
|
||||
{
|
||||
fprintf(stderr, "Return code from gui: %d\n", event.user.code);
|
||||
switch (event.user.code)
|
||||
{
|
||||
case DO_RESET:
|
||||
TheC64->Reset();
|
||||
break;
|
||||
case DO_QUIT:
|
||||
quit_requested = true;
|
||||
break;
|
||||
case DO_USEPREFS:
|
||||
TheC64->NewPrefs(&DialogPrefs);
|
||||
ThePrefs = DialogPrefs;
|
||||
break;
|
||||
case DO_SAVEPREFS:
|
||||
TheC64->NewPrefs(&DialogPrefs);
|
||||
ThePrefs = DialogPrefs;
|
||||
ThePrefs.Save(Frodo::get_prefs_path());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
start_GUI_thread();
|
||||
break;
|
||||
// Key pressed
|
||||
case SDL_KEYDOWN:
|
||||
// fprintf(stderr, "SDL-Key: %d\n", event.key.keysym.sym);
|
||||
if (tab_pressed && event.key.keysym.sym == SDLK_j)
|
||||
{
|
||||
if (joy_emu < 2)
|
||||
joy_emu++;
|
||||
else
|
||||
joy_emu = 0;
|
||||
}
|
||||
if (tab_pressed && event.key.keysym.sym == SDLK_p)
|
||||
{
|
||||
// NMI (Restore)
|
||||
TheC64->NMI();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_TAB:
|
||||
tab_pressed = true;
|
||||
break;
|
||||
|
||||
case SDLK_F9: // F9: Invoke SAM
|
||||
SAM(TheC64);
|
||||
break;
|
||||
|
||||
case SDLK_F11: // F10: Quit
|
||||
// Iconify not implemented in Qtopia SDL yet. Quit instead show gui.
|
||||
//SDL_WM_IconifyWindow();
|
||||
quit_requested = true;
|
||||
break;
|
||||
|
||||
case SDLK_F12: // F12: Reset
|
||||
TheC64->Reset();
|
||||
break;
|
||||
|
||||
case SDLK_KP_PLUS: // '+' on keypad: Increase SkipFrames
|
||||
ThePrefs.SkipFrames++;
|
||||
break;
|
||||
|
||||
case SDLK_KP_MINUS: // '-' on keypad: Decrease SkipFrames
|
||||
if (ThePrefs.SkipFrames > 1)
|
||||
ThePrefs.SkipFrames--;
|
||||
break;
|
||||
|
||||
case SDLK_KP_MULTIPLY: // '*' on keypad: Toggle speed limiter
|
||||
ThePrefs.LimitSpeed = !ThePrefs.LimitSpeed;
|
||||
break;
|
||||
|
||||
default:
|
||||
translate_key(event.key.keysym.sym, false, key_matrix, rev_matrix, joystick);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Key released
|
||||
case SDL_KEYUP:
|
||||
if (event.key.keysym.sym == SDLK_TAB)
|
||||
tab_pressed = false;
|
||||
else
|
||||
{
|
||||
translate_key(event.key.keysym.sym, true, key_matrix, rev_matrix, joystick);
|
||||
}
|
||||
break;
|
||||
|
||||
// Quit Frodo
|
||||
case SDL_QUIT:
|
||||
quit_requested = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check if NumLock is down (for switching the joystick keyboard emulation)
|
||||
*/
|
||||
|
||||
bool C64Display::NumLock(void)
|
||||
{
|
||||
if (joy_emu == 2)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open/close joystick drivers given old and new state of
|
||||
* joystick preferences
|
||||
*/
|
||||
|
||||
void C64::open_close_joystick(int port, int oldjoy, int newjoy)
|
||||
{
|
||||
if (oldjoy != newjoy) {
|
||||
joy_minx[port] = joy_miny[port] = 32767; // Reset calibration
|
||||
joy_maxx[port] = joy_maxy[port] = -32768;
|
||||
if (newjoy) {
|
||||
joy[port] = SDL_JoystickOpen(newjoy - 1);
|
||||
if (joy[port] == NULL)
|
||||
fprintf(stderr, "Couldn't open joystick %d\n", port + 1);
|
||||
} else {
|
||||
if (joy[port]) {
|
||||
SDL_JoystickClose(joy[port]);
|
||||
joy[port] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
||||
{
|
||||
open_close_joystick(0, oldjoy1, newjoy1);
|
||||
open_close_joystick(1, oldjoy2, newjoy2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll joystick port, return CIA mask
|
||||
*/
|
||||
|
||||
uint8 C64::poll_joystick(int port)
|
||||
{
|
||||
uint8 j = 0xff;
|
||||
|
||||
if (port == 0 && (joy[0] || joy[1]))
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
if (joy[port]) {
|
||||
int x = SDL_JoystickGetAxis(joy[port], 0), y = SDL_JoystickGetAxis(joy[port], 1);
|
||||
|
||||
if (x > joy_maxx[port])
|
||||
joy_maxx[port] = x;
|
||||
if (x < joy_minx[port])
|
||||
joy_minx[port] = x;
|
||||
if (y > joy_maxy[port])
|
||||
joy_maxy[port] = y;
|
||||
if (y < joy_miny[port])
|
||||
joy_miny[port] = y;
|
||||
|
||||
if (joy_maxx[port] - joy_minx[port] < 100 || joy_maxy[port] - joy_miny[port] < 100)
|
||||
return 0xff;
|
||||
|
||||
if (x < (joy_minx[port] + (joy_maxx[port]-joy_minx[port])/3))
|
||||
j &= 0xfb; // Left
|
||||
else if (x > (joy_minx[port] + 2*(joy_maxx[port]-joy_minx[port])/3))
|
||||
j &= 0xf7; // Right
|
||||
|
||||
if (y < (joy_miny[port] + (joy_maxy[port]-joy_miny[port])/3))
|
||||
j &= 0xfe; // Up
|
||||
else if (y > (joy_miny[port] + 2*(joy_maxy[port]-joy_miny[port])/3))
|
||||
j &= 0xfd; // Down
|
||||
|
||||
if (SDL_JoystickGetButton(joy[port], 0))
|
||||
j &= 0xef; // Button
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate C64 colors
|
||||
*/
|
||||
|
||||
void C64Display::InitColors(uint8 *colors)
|
||||
{
|
||||
SDL_Color palette[PALETTE_SIZE];
|
||||
for (int i=0; i<16; i++)
|
||||
{
|
||||
palette[i].r = palette_red[i];
|
||||
palette[i].g = palette_green[i];
|
||||
palette[i].b = palette_blue[i];
|
||||
}
|
||||
palette[fill_gray].r = palette[fill_gray].g = palette[fill_gray].b = 0xd0;
|
||||
palette[shine_gray].r = palette[shine_gray].g = palette[shine_gray].b = 0xf0;
|
||||
palette[shadow_gray].r = palette[shadow_gray].g = palette[shadow_gray].b = 0x80;
|
||||
palette[red].r = 0xf0;
|
||||
palette[red].g = palette[red].b = 0;
|
||||
palette[green].g = 0xf0;
|
||||
palette[green].r = palette[green].b = 0;
|
||||
SDL_SetColors(screen, palette, 0, PALETTE_SIZE);
|
||||
|
||||
for (int i=0; i<256; i++)
|
||||
colors[i] = i & 0x0f;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a requester (error message)
|
||||
*/
|
||||
|
||||
long int ShowRequester(const char *a, const char *b, const char *)
|
||||
{
|
||||
printf("%s: %s\n", a, b);
|
||||
return 1;
|
||||
}
|
2380
Src/Display_WIN32.h
2380
Src/Display_WIN32.h
File diff suppressed because it is too large
Load Diff
@ -1,569 +0,0 @@
|
||||
/*
|
||||
* Display_svga.h - C64 graphics display, emulator window handling,
|
||||
* SVGAlib specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2009 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <vga.h>
|
||||
#include <vgamouse.h>
|
||||
#include <vgakeyboard.h>
|
||||
|
||||
#include "C64.h"
|
||||
|
||||
|
||||
#define SCODE_CURSORBLOCKUP 103 /* Cursor key block. */
|
||||
#define SCODE_CURSORBLOCKLEFT 105
|
||||
#define SCODE_CURSORBLOCKRIGHT 106
|
||||
#define SCODE_CURSORBLOCKDOWN 108
|
||||
|
||||
#define SCODE_INSERT 110
|
||||
#define SCODE_HOME 102
|
||||
#define SCODE_PGUP 104
|
||||
#define SCODE_DELETE 111
|
||||
#define SCODE_END 107
|
||||
#define SCODE_PGDN 109
|
||||
|
||||
#define SCODE_NUMLOCK 69
|
||||
|
||||
#define SCODE_KEYPAD0 82
|
||||
#define SCODE_KEYPAD1 79
|
||||
#define SCODE_KEYPAD2 80
|
||||
#define SCODE_KEYPAD3 81
|
||||
#define SCODE_KEYPAD4 75
|
||||
#define SCODE_KEYPAD5 76
|
||||
#define SCODE_KEYPAD6 77
|
||||
#define SCODE_KEYPAD7 71
|
||||
#define SCODE_KEYPAD8 72
|
||||
#define SCODE_KEYPAD9 73
|
||||
#define SCODE_KEYPADENTER 96
|
||||
#define SCODE_KEYPADPLUS 78
|
||||
#define SCODE_KEYPADMINUS 74
|
||||
#define SCODE_KEYPADMULTIPLY 55
|
||||
#define SCODE_KEYPADDIVIDE 98
|
||||
|
||||
#define SCODE_Q 16
|
||||
#define SCODE_W 17
|
||||
#define SCODE_E 18
|
||||
#define SCODE_R 19
|
||||
#define SCODE_T 20
|
||||
#define SCODE_Y 21
|
||||
#define SCODE_U 22
|
||||
#define SCODE_I 23
|
||||
#define SCODE_O 24
|
||||
#define SCODE_P 25
|
||||
|
||||
#define SCODE_A 30
|
||||
#define SCODE_S 31
|
||||
#define SCODE_D 32
|
||||
#define SCODE_F 33
|
||||
#define SCODE_G 34
|
||||
#define SCODE_H 35
|
||||
#define SCODE_J 36
|
||||
#define SCODE_K 37
|
||||
#define SCODE_L 38
|
||||
|
||||
#define SCODE_Z 44
|
||||
#define SCODE_X 45
|
||||
#define SCODE_C 46
|
||||
#define SCODE_V 47
|
||||
#define SCODE_B 48
|
||||
#define SCODE_N 49
|
||||
#define SCODE_M 50
|
||||
|
||||
#define SCODE_ESCAPE 1
|
||||
#define SCODE_ENTER 28
|
||||
#define SCODE_RIGHTCONTROL 97
|
||||
#define SCODE_CONTROL 97
|
||||
#define SCODE_RIGHTALT 100
|
||||
#define SCODE_LEFTCONTROL 29
|
||||
#define SCODE_LEFTALT 56
|
||||
#define SCODE_SPACE 57
|
||||
|
||||
#define SCODE_F1 59
|
||||
#define SCODE_F2 60
|
||||
#define SCODE_F3 61
|
||||
#define SCODE_F4 62
|
||||
#define SCODE_F5 63
|
||||
#define SCODE_F6 64
|
||||
#define SCODE_F7 65
|
||||
#define SCODE_F8 66
|
||||
#define SCODE_F9 67
|
||||
#define SCODE_F10 68
|
||||
|
||||
#define SCODE_0 11
|
||||
#define SCODE_1 2
|
||||
#define SCODE_2 3
|
||||
#define SCODE_3 4
|
||||
#define SCODE_4 5
|
||||
#define SCODE_5 6
|
||||
#define SCODE_6 7
|
||||
#define SCODE_7 8
|
||||
#define SCODE_8 9
|
||||
#define SCODE_9 10
|
||||
|
||||
#define SCODE_LEFTSHIFT 42
|
||||
#define SCODE_RIGHTSHIFT 54
|
||||
#define SCODE_TAB 15
|
||||
|
||||
#define SCODE_F11 87
|
||||
#define SCODE_F12 88
|
||||
#define SCODE_NEXT 81
|
||||
#define SCODE_PRIOR 73
|
||||
#define SCODE_BS 14
|
||||
|
||||
#define SCODE_asciicircum 41
|
||||
#define SCODE_bracketleft 26
|
||||
#define SCODE_bracketright 27
|
||||
#define SCODE_comma 51
|
||||
#define SCODE_period 52
|
||||
#define SCODE_slash 53
|
||||
#define SCODE_semicolon 39
|
||||
#define SCODE_grave 40
|
||||
#define SCODE_minus 12
|
||||
#define SCODE_equal 13
|
||||
#define SCODE_numbersign 43
|
||||
#define SCODE_ltgt 86
|
||||
#define SCODE_scrolllock 70
|
||||
|
||||
static int bitdepth;
|
||||
static char *bufmem;
|
||||
static int hsize;
|
||||
static vga_modeinfo modeinfo;
|
||||
static char *linear_mem;
|
||||
|
||||
static int keystate[256];
|
||||
static int f11pressed = 0, f12pressed = 0, quit = 0;
|
||||
static int joystate = 0xFF;
|
||||
static int numlock = 0;
|
||||
static uint8 rev_matrix[8], key_matrix[8];
|
||||
|
||||
/*
|
||||
C64 keyboard matrix:
|
||||
|
||||
Bit 7 6 5 4 3 2 1 0
|
||||
0 CUD F5 F3 F1 F7 CLR RET DEL
|
||||
1 SHL E S Z 4 A W 3
|
||||
2 X T F C 6 D R 5
|
||||
3 V U H B 8 G Y 7
|
||||
4 N O K M 0 J I 9
|
||||
5 , @ : . - L P +
|
||||
6 / ^ = SHR HOM ; * Ł
|
||||
7 R/S Q C= SPC 2 CTL <- 1
|
||||
*/
|
||||
#define MATRIX(a,b) (((a) << 3) | (b))
|
||||
#define KEY_F10 512
|
||||
#define KEY_F11 513
|
||||
#define KEY_F12 514
|
||||
|
||||
#define KEY_FIRE 515
|
||||
#define KEY_JUP 516
|
||||
#define KEY_JDN 517
|
||||
#define KEY_JLF 518
|
||||
#define KEY_JRT 519
|
||||
|
||||
#define KEY_NUMLOCK 520
|
||||
|
||||
#define KEY_KPPLUS 521
|
||||
#define KEY_KPMINUS 522
|
||||
#define KEY_KPMULT 523
|
||||
#define KEY_KPDIV 524
|
||||
|
||||
static int scode2c64(int scancode)
|
||||
{
|
||||
switch (scancode) {
|
||||
case SCODE_asciicircum: return MATRIX(7,1);
|
||||
case SCODE_KEYPAD0: return KEY_FIRE;
|
||||
case SCODE_KEYPAD1: return -1;
|
||||
case SCODE_KEYPAD2: return KEY_JDN;
|
||||
case SCODE_KEYPAD3: return -1;
|
||||
case SCODE_KEYPAD4: return KEY_JLF;
|
||||
case SCODE_KEYPAD5: return -1;
|
||||
case SCODE_KEYPAD6: return KEY_JRT;
|
||||
case SCODE_KEYPAD7: return -1;
|
||||
case SCODE_KEYPAD8: return KEY_JUP;
|
||||
case SCODE_KEYPAD9: return -1;
|
||||
|
||||
case SCODE_NUMLOCK: return KEY_NUMLOCK;
|
||||
case SCODE_KEYPADMULTIPLY: return KEY_KPMULT;
|
||||
case SCODE_KEYPADDIVIDE: return KEY_KPDIV;
|
||||
case SCODE_KEYPADMINUS: return KEY_KPMINUS;
|
||||
case SCODE_KEYPADPLUS: return KEY_KPPLUS;
|
||||
case SCODE_KEYPADENTER: return MATRIX(0,1);
|
||||
|
||||
case SCODE_F10: return KEY_F10;
|
||||
case SCODE_F11: return KEY_F11;
|
||||
case SCODE_F12: return KEY_F12;
|
||||
|
||||
case SCODE_comma: return MATRIX(5,7);
|
||||
case SCODE_period: return MATRIX(5,4);
|
||||
|
||||
case SCODE_A: return MATRIX(1,2);
|
||||
case SCODE_B: return MATRIX(3,4);
|
||||
case SCODE_C: return MATRIX(2,4);
|
||||
case SCODE_D: return MATRIX(2,2);
|
||||
case SCODE_E: return MATRIX(1,6);
|
||||
case SCODE_F: return MATRIX(2,5);
|
||||
case SCODE_G: return MATRIX(3,2);
|
||||
case SCODE_H: return MATRIX(3,5);
|
||||
case SCODE_I: return MATRIX(4,1);
|
||||
case SCODE_J: return MATRIX(4,2);
|
||||
case SCODE_K: return MATRIX(4,5);
|
||||
case SCODE_L: return MATRIX(5,2);
|
||||
case SCODE_M: return MATRIX(4,4);
|
||||
case SCODE_N: return MATRIX(4,7);
|
||||
case SCODE_O: return MATRIX(4,6);
|
||||
case SCODE_P: return MATRIX(5,1);
|
||||
case SCODE_Q: return MATRIX(7,6);
|
||||
case SCODE_R: return MATRIX(2,1);
|
||||
case SCODE_S: return MATRIX(1,5);
|
||||
case SCODE_T: return MATRIX(2,6);
|
||||
case SCODE_U: return MATRIX(3,6);
|
||||
case SCODE_V: return MATRIX(3,7);
|
||||
case SCODE_W: return MATRIX(1,1);
|
||||
case SCODE_X: return MATRIX(2,7);
|
||||
case SCODE_Y: return MATRIX(3,1);
|
||||
case SCODE_Z: return MATRIX(1,4);
|
||||
|
||||
case SCODE_BS: return MATRIX(0,0);
|
||||
case SCODE_DELETE: return MATRIX(0,0);
|
||||
case SCODE_LEFTCONTROL: return MATRIX(7,2);
|
||||
case SCODE_TAB: return MATRIX(7,1);
|
||||
case SCODE_ENTER: return MATRIX(0,1);
|
||||
case SCODE_SPACE: return MATRIX(7,4);
|
||||
case SCODE_LEFTSHIFT: return MATRIX(1,7);
|
||||
case SCODE_RIGHTSHIFT: return MATRIX(6,4);
|
||||
case SCODE_ESCAPE: return MATRIX(7,7);
|
||||
case SCODE_RIGHTCONTROL:
|
||||
case SCODE_LEFTALT:
|
||||
case SCODE_RIGHTALT: return MATRIX(7,5);
|
||||
|
||||
case SCODE_INSERT: return MATRIX(0,0) | 0x80;
|
||||
case SCODE_HOME: return MATRIX(6,3);
|
||||
case SCODE_END: return MATRIX(6,0);
|
||||
case SCODE_PGUP: return MATRIX(6,6);
|
||||
case SCODE_PGDN: return MATRIX(6,5);
|
||||
|
||||
case SCODE_CURSORBLOCKUP: return MATRIX(0,7)| 0x80;
|
||||
case SCODE_CURSORBLOCKDOWN: return MATRIX(0,7);
|
||||
case SCODE_CURSORBLOCKLEFT: return MATRIX(0,2) | 0x80;
|
||||
case SCODE_CURSORBLOCKRIGHT: return MATRIX(0,2);
|
||||
|
||||
case SCODE_F1: return MATRIX(0,4);
|
||||
case SCODE_F2: return MATRIX(0,4) | 0x80;
|
||||
case SCODE_F3: return MATRIX(0,5);
|
||||
case SCODE_F4: return MATRIX(0,5) | 0x80;
|
||||
case SCODE_F5: return MATRIX(0,6);
|
||||
case SCODE_F6: return MATRIX(0,6) | 0x80;
|
||||
case SCODE_F7: return MATRIX(0,3);
|
||||
case SCODE_F8: return MATRIX(0,3) | 0x80;
|
||||
|
||||
case SCODE_0: return MATRIX(4,3);
|
||||
case SCODE_1: return MATRIX(7,0);
|
||||
case SCODE_2: return MATRIX(7,3);
|
||||
case SCODE_3: return MATRIX(1,0);
|
||||
case SCODE_4: return MATRIX(1,3);
|
||||
case SCODE_5: return MATRIX(2,0);
|
||||
case SCODE_6: return MATRIX(2,3);
|
||||
case SCODE_7: return MATRIX(3,0);
|
||||
case SCODE_8: return MATRIX(3,3);
|
||||
case SCODE_9: return MATRIX(4,0);
|
||||
|
||||
case SCODE_bracketleft: return MATRIX(5,6);
|
||||
case SCODE_bracketright: return MATRIX(6,1);
|
||||
case SCODE_slash: return MATRIX(6,7);
|
||||
case SCODE_semicolon: return MATRIX(5,5);
|
||||
case SCODE_grave: return MATRIX(6,2);
|
||||
case SCODE_numbersign: return MATRIX(6,5);
|
||||
case SCODE_ltgt: return MATRIX(6,6);
|
||||
case SCODE_minus: return MATRIX(5,0);
|
||||
case SCODE_equal: return MATRIX(5,3);
|
||||
}
|
||||
}
|
||||
|
||||
static void my_kbd_handler(int scancode, int newstate)
|
||||
{
|
||||
int kc = scode2c64(scancode);
|
||||
#if 0
|
||||
if (kc == -1) {
|
||||
printf("%d\n",kc);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (newstate == KEY_EVENTPRESS) {
|
||||
switch (kc) {
|
||||
case KEY_KPPLUS:
|
||||
if (ThePrefs.SkipFrames < 10)
|
||||
ThePrefs.SkipFrames++;
|
||||
break;
|
||||
|
||||
case KEY_KPMINUS:
|
||||
if (ThePrefs.SkipFrames > 1)
|
||||
ThePrefs.SkipFrames--;
|
||||
break;
|
||||
|
||||
case KEY_KPMULT:
|
||||
ThePrefs.LimitSpeed = !ThePrefs.LimitSpeed;
|
||||
break;
|
||||
|
||||
case KEY_KPDIV:
|
||||
ThePrefs.JoystickSwap = !ThePrefs.JoystickSwap;
|
||||
break;
|
||||
|
||||
case KEY_NUMLOCK:
|
||||
numlock = !numlock;
|
||||
break;
|
||||
|
||||
case KEY_F10:
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
case KEY_F11:
|
||||
f11pressed = 1;
|
||||
break;
|
||||
|
||||
case KEY_F12:
|
||||
f12pressed = 1;
|
||||
break;
|
||||
|
||||
case KEY_FIRE:
|
||||
joystate &= ~0x10;
|
||||
break;
|
||||
|
||||
case KEY_JDN:
|
||||
joystate &= ~0x2;
|
||||
break;
|
||||
|
||||
case KEY_JUP:
|
||||
joystate &= ~0x1;
|
||||
break;
|
||||
|
||||
case KEY_JLF:
|
||||
joystate &= ~0x4;
|
||||
break;
|
||||
|
||||
case KEY_JRT:
|
||||
joystate &= ~0x8;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (keystate[kc])
|
||||
break;
|
||||
keystate[kc] = 1;
|
||||
int c64_byte, c64_bit, shifted;
|
||||
c64_byte = kc >> 3;
|
||||
c64_bit = kc & 7;
|
||||
shifted = kc & 128;
|
||||
c64_byte &= 7;
|
||||
if (shifted) {
|
||||
key_matrix[6] &= 0xef;
|
||||
rev_matrix[4] &= 0xbf;
|
||||
}
|
||||
key_matrix[c64_byte] &= ~(1 << c64_bit);
|
||||
rev_matrix[c64_bit] &= ~(1 << c64_byte);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (kc) {
|
||||
case KEY_FIRE:
|
||||
joystate |= 0x10;
|
||||
break;
|
||||
|
||||
case KEY_JDN:
|
||||
joystate |= 0x2;
|
||||
break;
|
||||
|
||||
case KEY_JUP:
|
||||
joystate |= 0x1;
|
||||
break;
|
||||
|
||||
case KEY_JLF:
|
||||
joystate |= 0x4;
|
||||
break;
|
||||
|
||||
case KEY_JRT:
|
||||
joystate |= 0x8;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!keystate[kc])
|
||||
break;
|
||||
keystate[kc] = 0;
|
||||
int c64_byte, c64_bit, shifted;
|
||||
c64_byte = kc >> 3;
|
||||
c64_bit = kc & 7;
|
||||
shifted = kc & 128;
|
||||
c64_byte &= 7;
|
||||
if (shifted) {
|
||||
key_matrix[6] |= 0x10;
|
||||
rev_matrix[4] |= 0x40;
|
||||
}
|
||||
key_matrix[c64_byte] |= (1 << c64_bit);
|
||||
rev_matrix[c64_bit] |= (1 << c64_byte);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
{
|
||||
quit_requested = false;
|
||||
}
|
||||
|
||||
|
||||
C64Display::~C64Display()
|
||||
{
|
||||
sleep(1);
|
||||
vga_setmode(TEXT);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prefs may have changed
|
||||
*/
|
||||
|
||||
void C64Display::NewPrefs(Prefs *prefs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void C64Display::Speedometer(int speed)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int init_graphics(void)
|
||||
{
|
||||
int vgamode = G640x480x256;
|
||||
modeinfo = *vga_getmodeinfo (vgamode);
|
||||
|
||||
if (vga_setmode(vgamode) < 0) {
|
||||
sleep(1);
|
||||
vga_setmode(TEXT);
|
||||
fprintf(stderr, "SVGAlib doesn't like my video mode. Giving up.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
hsize = modeinfo.linewidth;
|
||||
if (hsize < DISPLAY_X)
|
||||
hsize = DISPLAY_X;
|
||||
|
||||
bufmem = NULL;
|
||||
if ((modeinfo.flags & CAPABLE_LINEAR) && modeinfo.linewidth >= DISPLAY_X) {
|
||||
if (vga_setlinearaddressing() != -1) {
|
||||
linear_mem = (char *)vga_getgraphmem();
|
||||
printf("Using linear addressing: %p.\n", linear_mem);
|
||||
bufmem = linear_mem;
|
||||
}
|
||||
}
|
||||
if (bufmem == NULL)
|
||||
bufmem = (char *)malloc(hsize * DISPLAY_Y);
|
||||
|
||||
if (keyboard_init() != 0)
|
||||
abort();
|
||||
keyboard_seteventhandler(my_kbd_handler);
|
||||
/* keyboard_translatekeys(DONT_CATCH_CTRLC);*/
|
||||
|
||||
memset(keystate, 0, sizeof(keystate));
|
||||
memset(key_matrix, 0xFF, 8);
|
||||
memset(rev_matrix, 0xFF, 8);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void C64Display::Update(void)
|
||||
{
|
||||
int y;
|
||||
|
||||
if (linear_mem)
|
||||
return;
|
||||
|
||||
for (y = 0; y < DISPLAY_Y; y++) {
|
||||
vga_drawscanline(y, (uint8 *)bufmem + hsize * y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8 *C64Display::BitmapBase(void)
|
||||
{
|
||||
return (uint8 *)bufmem;
|
||||
}
|
||||
|
||||
|
||||
int C64Display::BitmapXMod(void)
|
||||
{
|
||||
return hsize;
|
||||
}
|
||||
|
||||
|
||||
void C64Display::PollKeyboard(uint8 *CIA_key_matrix, uint8 *CIA_rev_matrix, uint8 *joystick)
|
||||
{
|
||||
keyboard_update();
|
||||
*joystick = joystate;
|
||||
memcpy(CIA_key_matrix, key_matrix, 8);
|
||||
memcpy(CIA_rev_matrix, rev_matrix, 8);
|
||||
if (f11pressed)
|
||||
TheC64->NMI();
|
||||
if (f12pressed)
|
||||
TheC64->Reset();
|
||||
if (quit)
|
||||
quit_requested = true;
|
||||
f11pressed = f12pressed = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check if NumLock is down (for switching the joystick keyboard emulation)
|
||||
*/
|
||||
|
||||
bool C64Display::NumLock(void)
|
||||
{
|
||||
return numlock;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate C64 colors
|
||||
*/
|
||||
|
||||
static int colorval(int v)
|
||||
{
|
||||
return ((v & 255)*0x01010101) >> 26;
|
||||
}
|
||||
|
||||
void C64Display::InitColors(uint8 *colors)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i< 256; i++) {
|
||||
vga_setpalette(i, colorval(palette_red[i & 0x0f]), colorval(palette_green[i & 0x0f]), colorval(palette_blue[i & 0x0f]));
|
||||
colors[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a requester (error message)
|
||||
*/
|
||||
|
||||
long int ShowRequester(const char *a, const char *b, const char *)
|
||||
{
|
||||
printf("%s: %s\n", a, b);
|
||||
return 1;
|
||||
}
|
826
Src/Display_x.h
826
Src/Display_x.h
@ -1,826 +0,0 @@
|
||||
/*
|
||||
* Display_x.h - C64 graphics display, emulator window handling,
|
||||
* X specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2009 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "SAM.h"
|
||||
#include "C64.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
#if defined(X_USE_SHM)
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
static XShmSegmentInfo shminfo;
|
||||
#endif
|
||||
|
||||
static Display *display;
|
||||
static int screen;
|
||||
static Window rootwin, mywin;
|
||||
|
||||
static GC black_gc, led_gc;
|
||||
static XColor black, fill_gray, shine_gray, shadow_gray, red, green;
|
||||
static Colormap cmap;
|
||||
static Font led_font;
|
||||
|
||||
static XImage *img;
|
||||
static Visual *vis;
|
||||
static XVisualInfo visualInfo;
|
||||
static int bitdepth;
|
||||
static char *bufmem;
|
||||
static int hsize;
|
||||
|
||||
// For LED error blinking
|
||||
static C64Display *c64_disp;
|
||||
static struct sigaction pulse_sa;
|
||||
static itimerval pulse_tv;
|
||||
|
||||
// Keyboard and joystick
|
||||
static int keystate[256];
|
||||
static int joystate = 0xFF;
|
||||
static bool num_locked = false;
|
||||
|
||||
static const long int eventmask = (KeyPressMask|KeyReleaseMask|FocusChangeMask|ExposureMask);
|
||||
|
||||
|
||||
/*
|
||||
C64 keyboard matrix:
|
||||
|
||||
Bit 7 6 5 4 3 2 1 0
|
||||
0 CUD F5 F3 F1 F7 CLR RET DEL
|
||||
1 SHL E S Z 4 A W 3
|
||||
2 X T F C 6 D R 5
|
||||
3 V U H B 8 G Y 7
|
||||
4 N O K M 0 J I 9
|
||||
5 , @ : . - L P +
|
||||
6 / ^ = SHR HOM ; * £
|
||||
7 R/S Q C= SPC 2 CTL <- 1
|
||||
*/
|
||||
|
||||
#define MATRIX(a,b) (((a) << 3) | (b))
|
||||
|
||||
#define KEY_F9 512
|
||||
#define KEY_F10 513
|
||||
#define KEY_F11 514
|
||||
#define KEY_F12 515
|
||||
|
||||
#ifdef SUN
|
||||
#define KEY_FIRE 58
|
||||
#define KEY_JU 135
|
||||
#define KEY_JD 7
|
||||
#define KEY_JL 130
|
||||
#define KEY_JR 2
|
||||
#else
|
||||
#define KEY_FIRE 516
|
||||
#define KEY_JU 517
|
||||
#define KEY_JD 518
|
||||
#define KEY_JL 519
|
||||
#define KEY_JR 520
|
||||
#endif
|
||||
|
||||
#define KEY_JUL 521
|
||||
#define KEY_JUR 522
|
||||
#define KEY_JDL 523
|
||||
#define KEY_JDR 524
|
||||
|
||||
#define KEY_KP_PLUS 525
|
||||
#define KEY_KP_MINUS 526
|
||||
#define KEY_KP_MULT 527
|
||||
#define KEY_NUM_LOCK 528
|
||||
|
||||
|
||||
/*
|
||||
* Decode KeySyms. This function knows about all keys that
|
||||
* are common between different keyboard languages.
|
||||
*/
|
||||
|
||||
static int kc_decode(KeySym ks)
|
||||
{
|
||||
switch (ks) {
|
||||
case XK_A: case XK_a: return MATRIX(1,2);
|
||||
case XK_B: case XK_b: return MATRIX(3,4);
|
||||
case XK_C: case XK_c: return MATRIX(2,4);
|
||||
case XK_D: case XK_d: return MATRIX(2,2);
|
||||
case XK_E: case XK_e: return MATRIX(1,6);
|
||||
case XK_F: case XK_f: return MATRIX(2,5);
|
||||
case XK_G: case XK_g: return MATRIX(3,2);
|
||||
case XK_H: case XK_h: return MATRIX(3,5);
|
||||
case XK_I: case XK_i: return MATRIX(4,1);
|
||||
case XK_J: case XK_j: return MATRIX(4,2);
|
||||
case XK_K: case XK_k: return MATRIX(4,5);
|
||||
case XK_L: case XK_l: return MATRIX(5,2);
|
||||
case XK_M: case XK_m: return MATRIX(4,4);
|
||||
case XK_N: case XK_n: return MATRIX(4,7);
|
||||
case XK_O: case XK_o: return MATRIX(4,6);
|
||||
case XK_P: case XK_p: return MATRIX(5,1);
|
||||
case XK_Q: case XK_q: return MATRIX(7,6);
|
||||
case XK_R: case XK_r: return MATRIX(2,1);
|
||||
case XK_S: case XK_s: return MATRIX(1,5);
|
||||
case XK_T: case XK_t: return MATRIX(2,6);
|
||||
case XK_U: case XK_u: return MATRIX(3,6);
|
||||
case XK_V: case XK_v: return MATRIX(3,7);
|
||||
case XK_W: case XK_w: return MATRIX(1,1);
|
||||
case XK_X: case XK_x: return MATRIX(2,7);
|
||||
case XK_Y: case XK_y: return MATRIX(3,1);
|
||||
case XK_Z: case XK_z: return MATRIX(1,4);
|
||||
|
||||
case XK_0: return MATRIX(4,3);
|
||||
case XK_1: return MATRIX(7,0);
|
||||
case XK_2: return MATRIX(7,3);
|
||||
case XK_3: return MATRIX(1,0);
|
||||
case XK_4: return MATRIX(1,3);
|
||||
case XK_5: return MATRIX(2,0);
|
||||
case XK_6: return MATRIX(2,3);
|
||||
case XK_7: return MATRIX(3,0);
|
||||
case XK_8: return MATRIX(3,3);
|
||||
case XK_9: return MATRIX(4,0);
|
||||
|
||||
case XK_space: return MATRIX(7,4);
|
||||
case XK_grave: return MATRIX(7,1);
|
||||
case XK_backslash: return MATRIX(6,6);
|
||||
case XK_comma: return MATRIX(5,7);
|
||||
case XK_period: return MATRIX(5,4);
|
||||
|
||||
case XK_Escape: return MATRIX(7,7);
|
||||
case XK_Return: return MATRIX(0,1);
|
||||
case XK_BackSpace: case XK_Delete: return MATRIX(0,0);
|
||||
case XK_Insert: return MATRIX(6,3);
|
||||
case XK_Home: case XK_Help: return MATRIX(6,3);
|
||||
case XK_End: return MATRIX(6,0);
|
||||
#ifdef __hpux
|
||||
case XK_Prior: return MATRIX(6,0);
|
||||
case XK_Next: return MATRIX(6,5);
|
||||
#else
|
||||
case XK_Page_Up: return MATRIX(6,0);
|
||||
case XK_Page_Down: return MATRIX(6,5);
|
||||
#endif
|
||||
case XK_Control_L: return MATRIX(7,2);
|
||||
case XK_Control_R: return MATRIX(7,5);
|
||||
case XK_Shift_L: return MATRIX(1,7);
|
||||
case XK_Shift_R: return MATRIX(6,4);
|
||||
case XK_Alt_L: return MATRIX(7,5);
|
||||
case XK_Alt_R: return MATRIX(7,5);
|
||||
|
||||
case XK_Up: return MATRIX(0,7)| 0x80;
|
||||
case XK_Down: return MATRIX(0,7);
|
||||
case XK_Left: return MATRIX(0,2) | 0x80;
|
||||
case XK_Right: return MATRIX(0,2);
|
||||
|
||||
case XK_F1: return MATRIX(0,4);
|
||||
case XK_F2: return MATRIX(0,4) | 0x80;
|
||||
case XK_F3: return MATRIX(0,5);
|
||||
case XK_F4: return MATRIX(0,5) | 0x80;
|
||||
case XK_F5: return MATRIX(0,6);
|
||||
case XK_F6: return MATRIX(0,6) | 0x80;
|
||||
case XK_F7: return MATRIX(0,3);
|
||||
case XK_F8: return MATRIX(0,3) | 0x80;
|
||||
|
||||
case XK_F9: return KEY_F9;
|
||||
case XK_F10: return KEY_F10;
|
||||
case XK_F11: return KEY_F11;
|
||||
case XK_F12: return KEY_F12;
|
||||
|
||||
/* You never know which Keysyms might be missing on some workstation
|
||||
* This #ifdef should be enough. */
|
||||
#if defined(XK_KP_Prior) && defined(XK_KP_Left) && defined(XK_KP_Insert) && defined (XK_KP_End)
|
||||
case XK_KP_0: case XK_KP_Insert: return KEY_FIRE;
|
||||
case XK_KP_1: case XK_KP_End: return KEY_JDL;
|
||||
case XK_KP_2: case XK_KP_Down: return KEY_JD;
|
||||
case XK_KP_3: case XK_KP_Next: return KEY_JDR;
|
||||
case XK_KP_4: case XK_KP_Left: return KEY_JL;
|
||||
case XK_KP_5: case XK_KP_Begin: return KEY_FIRE;
|
||||
case XK_KP_6: case XK_KP_Right: return KEY_JR;
|
||||
case XK_KP_7: case XK_KP_Home: return KEY_JUL;
|
||||
case XK_KP_8: case XK_KP_Up: return KEY_JU;
|
||||
case XK_KP_9: case XK_KP_Prior: return KEY_JUR;
|
||||
#else
|
||||
case XK_KP_0: return KEY_FIRE;
|
||||
case XK_KP_1: return KEY_JDL;
|
||||
case XK_KP_2: return KEY_JD;
|
||||
case XK_KP_3: return KEY_JDR;
|
||||
case XK_KP_4: return KEY_JL;
|
||||
case XK_KP_5: return KEY_FIRE;
|
||||
case XK_KP_6: return KEY_JR;
|
||||
case XK_KP_7: return KEY_JUL;
|
||||
case XK_KP_8: return KEY_JU;
|
||||
case XK_KP_9: return KEY_JUR;
|
||||
#endif
|
||||
|
||||
case XK_KP_Add: return KEY_KP_PLUS;
|
||||
case XK_KP_Subtract: return KEY_KP_MINUS;
|
||||
case XK_KP_Multiply: return KEY_KP_MULT;
|
||||
case XK_KP_Divide: return MATRIX(6,7);
|
||||
case XK_KP_Enter: return MATRIX(0,1);
|
||||
|
||||
#ifdef SUN
|
||||
case XK_Num_Lock: return KEY_NUM_LOCK;
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int decode_us(KeySym ks)
|
||||
{
|
||||
switch(ks) { /* US specific */
|
||||
case XK_minus: return MATRIX(5,0);
|
||||
case XK_equal: return MATRIX(5,3);
|
||||
case XK_bracketleft: return MATRIX(5,6);
|
||||
case XK_bracketright: return MATRIX(6,1);
|
||||
case XK_semicolon: return MATRIX(5,5);
|
||||
case XK_apostrophe: return MATRIX(6,2);
|
||||
case XK_slash: return MATRIX(6,7);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int decode_de(KeySym ks)
|
||||
{
|
||||
switch(ks) { /* DE specific */
|
||||
case XK_ssharp: return MATRIX(5,0);
|
||||
case XK_apostrophe: return MATRIX(5,3);
|
||||
case XK_Udiaeresis: case XK_udiaeresis: return MATRIX(5,6);
|
||||
case XK_plus: return MATRIX(6,1);
|
||||
case XK_Odiaeresis: case XK_odiaeresis: return MATRIX(5,5);
|
||||
case XK_Adiaeresis: case XK_adiaeresis: return MATRIX(6,2);
|
||||
case XK_numbersign: return MATRIX(6,5);
|
||||
case XK_less: case XK_greater: return MATRIX(6,0);
|
||||
case XK_minus: return MATRIX(6,7);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int keycode2c64(XKeyEvent *event)
|
||||
{
|
||||
KeySym ks;
|
||||
int as;
|
||||
int index = 0;
|
||||
|
||||
do {
|
||||
ks = XLookupKeysym(event, index);
|
||||
as = kc_decode(ks);
|
||||
|
||||
if (as == -1)
|
||||
as = KBD_LANG == 0 ? decode_us(ks) : decode_de(ks);
|
||||
if (as != -1)
|
||||
return as;
|
||||
index++;
|
||||
} while (ks != NoSymbol);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display constructor: Draw Speedometer/LEDs in window
|
||||
*/
|
||||
|
||||
C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
{
|
||||
int i;
|
||||
char str[16];
|
||||
|
||||
quit_requested = false;
|
||||
|
||||
// LEDs off
|
||||
for (i=0; i<4; i++)
|
||||
led_state[i] = old_led_state[i] = LED_OFF;
|
||||
|
||||
// Draw speedometer/LEDs
|
||||
led_gc = XCreateGC(display, mywin, 0, 0);
|
||||
XSetFont(display, led_gc, led_font);
|
||||
|
||||
XSetForeground(display, led_gc, fill_gray.pixel);
|
||||
XFillRectangle(display, mywin, led_gc, 0, DISPLAY_Y, DISPLAY_X-1, 16);
|
||||
|
||||
XSetForeground(display, led_gc, shine_gray.pixel);
|
||||
XDrawLine(display, mywin, led_gc, 0, DISPLAY_Y, DISPLAY_X-1, DISPLAY_Y);
|
||||
for (i=0; i<5; i++)
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5, DISPLAY_Y, DISPLAY_X*i/5, DISPLAY_Y+14);
|
||||
for (i=2; i<6; i++) {
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5-23, DISPLAY_Y+11, DISPLAY_X*i/5-9, DISPLAY_Y+11);
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5-9, DISPLAY_Y+11, DISPLAY_X*i/5-9, DISPLAY_Y+5);
|
||||
}
|
||||
|
||||
XSetForeground(display, led_gc, shadow_gray.pixel);
|
||||
XDrawLine(display, mywin, led_gc, 0, DISPLAY_Y+15, DISPLAY_X-1, DISPLAY_Y+15);
|
||||
for (i=1; i<6; i++)
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5-1, DISPLAY_Y+1, DISPLAY_X*i/5-1, DISPLAY_Y+15);
|
||||
for (i=2; i<6; i++) {
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5-24, DISPLAY_Y+11, DISPLAY_X*i/5-24, DISPLAY_Y+4);
|
||||
XDrawLine(display, mywin, led_gc, DISPLAY_X*i/5-24, DISPLAY_Y+4, DISPLAY_X*i/5-9, DISPLAY_Y+4);
|
||||
}
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
sprintf(str, "Drive %d", i+8);
|
||||
XSetForeground(display, led_gc, black.pixel);
|
||||
XDrawString(display, mywin, led_gc, DISPLAY_X*(i+1)/5+8, DISPLAY_Y+12, str, strlen(str));
|
||||
draw_led(i, LED_OFF);
|
||||
}
|
||||
|
||||
// Start timer for LED error blinking
|
||||
c64_disp = this;
|
||||
pulse_sa.sa_handler = (void (*)(int))pulse_handler;
|
||||
pulse_sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&pulse_sa.sa_mask);
|
||||
sigaction(SIGALRM, &pulse_sa, NULL);
|
||||
pulse_tv.it_interval.tv_sec = 0;
|
||||
pulse_tv.it_interval.tv_usec = 400000;
|
||||
pulse_tv.it_value.tv_sec = 0;
|
||||
pulse_tv.it_value.tv_usec = 400000;
|
||||
setitimer(ITIMER_REAL, &pulse_tv, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display destructor
|
||||
*/
|
||||
|
||||
C64Display::~C64Display()
|
||||
{
|
||||
XAutoRepeatOn(display);
|
||||
XSync(display, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prefs may have changed
|
||||
*/
|
||||
|
||||
void C64Display::NewPrefs(Prefs *prefs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Connect to X server and open window
|
||||
*/
|
||||
|
||||
int init_graphics(void)
|
||||
{
|
||||
int i;
|
||||
char *display_name = 0;
|
||||
XSetWindowAttributes wattr;
|
||||
XSizeHints *hints;
|
||||
XColor exact_color;
|
||||
int pixbytes;
|
||||
|
||||
display = XOpenDisplay(display_name);
|
||||
if (display == 0) {
|
||||
fprintf(stderr, "Can't connect to X server %s\n", XDisplayName(display_name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
screen = XDefaultScreen(display);
|
||||
rootwin = XRootWindow(display, screen);
|
||||
if (XMatchVisualInfo(display, screen, 8, PseudoColor, &visualInfo)) {
|
||||
/* for our HP boxes */
|
||||
} else if (XMatchVisualInfo(display, screen, 8, GrayScale, &visualInfo)) {
|
||||
} else {
|
||||
fprintf(stderr, "Can't obtain appropriate X visual\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
vis = visualInfo.visual;
|
||||
bitdepth = visualInfo.depth;
|
||||
pixbytes = (bitdepth == 24 || bitdepth == 32 ? 4 : bitdepth == 12 || bitdepth == 16 ? 2 : 1);
|
||||
fprintf(stderr, "Using %d bit visual\n", bitdepth);
|
||||
|
||||
hsize = (DISPLAY_X + 3) & ~3;
|
||||
|
||||
#if defined(X_USE_SHM)
|
||||
img = XShmCreateImage(display, vis, bitdepth, ZPixmap, 0, &shminfo,
|
||||
hsize, DISPLAY_Y);
|
||||
|
||||
shminfo.shmid = shmget(IPC_PRIVATE, DISPLAY_Y * img->bytes_per_line,
|
||||
IPC_CREAT | 0777);
|
||||
shminfo.shmaddr = img->data = bufmem = (char *)shmat(shminfo.shmid, 0, 0);
|
||||
shminfo.readOnly = False;
|
||||
XShmAttach(display, &shminfo);
|
||||
XSync(display,0);
|
||||
/* now deleting means making it temporary */
|
||||
shmctl(shminfo.shmid, IPC_RMID, 0);
|
||||
#else
|
||||
bufmem = (char *)malloc(pixbytes * hsize * DISPLAY_Y);
|
||||
img = XCreateImage(display, vis, bitdepth, ZPixmap, 0, bufmem, hsize, DISPLAY_Y, 32, 0);
|
||||
#endif
|
||||
|
||||
cmap = XCreateColormap(display, rootwin, vis, AllocNone);
|
||||
|
||||
XParseColor(display, cmap, "#000000", &black);
|
||||
if (!XAllocColor(display, cmap, &black))
|
||||
fprintf(stderr, "Whoops??\n");
|
||||
|
||||
wattr.event_mask = eventmask;
|
||||
wattr.background_pixel = black.pixel;
|
||||
wattr.backing_store = Always;
|
||||
wattr.backing_planes = bitdepth;
|
||||
wattr.border_pixmap = None;
|
||||
wattr.border_pixel = black.pixel;
|
||||
wattr.colormap = cmap;
|
||||
|
||||
mywin = XCreateWindow(display, rootwin, 0, 0, DISPLAY_X, DISPLAY_Y + 16, 0,
|
||||
bitdepth, InputOutput, vis,
|
||||
CWEventMask|CWBackPixel|CWBorderPixel|CWBackingStore
|
||||
|CWBackingPlanes|CWColormap,
|
||||
&wattr);
|
||||
XMapWindow(display, mywin);
|
||||
XStoreName(display, mywin, "Frodo");
|
||||
|
||||
if ((hints = XAllocSizeHints()) != NULL) {
|
||||
hints->min_width = DISPLAY_X;
|
||||
hints->max_width = DISPLAY_X;
|
||||
hints->min_height = DISPLAY_Y + 16;
|
||||
hints->max_height = DISPLAY_Y + 16;
|
||||
hints->flags = PMinSize | PMaxSize;
|
||||
XSetWMNormalHints(display, mywin, hints);
|
||||
XFree((char *)hints);
|
||||
}
|
||||
|
||||
black_gc = XCreateGC(display,mywin, 0, 0);
|
||||
XSetForeground(display, black_gc, black.pixel);
|
||||
|
||||
// Allocate colors for speedometer/LEDs
|
||||
if (!XAllocNamedColor(display, cmap, "rgb:d0/d0/d0", &fill_gray, &exact_color))
|
||||
return 0;
|
||||
if (!XAllocNamedColor(display, cmap, "rgb:e8/e8/e8", &shine_gray, &exact_color))
|
||||
return 0;
|
||||
if (!XAllocNamedColor(display, cmap, "rgb:98/98/98", &shadow_gray, &exact_color))
|
||||
return 0;
|
||||
if (!XAllocNamedColor(display, cmap, "rgb:f0/00/00", &red, &exact_color))
|
||||
return 0;
|
||||
if (!XAllocNamedColor(display, cmap, "rgb:00/f0/00", &green, &exact_color))
|
||||
return 0;
|
||||
|
||||
// Load font for speedometer/LED labels
|
||||
led_font = XLoadFont(display, "-*-helvetica-medium-r-*-*-10-*");
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
keystate[i] = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redraw bitmap
|
||||
*/
|
||||
|
||||
void C64Display::Update(void)
|
||||
{
|
||||
// Update C64 display
|
||||
XSync(display, 0);
|
||||
#if defined(X_USE_SHM)
|
||||
XShmPutImage(display, mywin, black_gc, img, 0, 0, 0, 0, DISPLAY_X, DISPLAY_Y, 0);
|
||||
#else
|
||||
XPutImage(display, mywin, black_gc, img, 0, 0, 0, 0, DISPLAY_X, DISPLAY_Y);
|
||||
#endif
|
||||
|
||||
// Update drive LEDs
|
||||
for (int i=0; i<4; i++)
|
||||
if (led_state[i] != old_led_state[i]) {
|
||||
draw_led(i, led_state[i]);
|
||||
old_led_state[i] = led_state[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw one drive LED
|
||||
*/
|
||||
|
||||
void C64Display::draw_led(int num, int state)
|
||||
{
|
||||
switch (state) {
|
||||
case LED_OFF:
|
||||
case LED_ERROR_OFF:
|
||||
XSetForeground(display, led_gc, black.pixel);
|
||||
break;
|
||||
case LED_ON:
|
||||
XSetForeground(display, led_gc, green.pixel);
|
||||
break;
|
||||
case LED_ERROR_ON:
|
||||
XSetForeground(display, led_gc, red.pixel);
|
||||
break;
|
||||
}
|
||||
XFillRectangle(display, mywin, led_gc, DISPLAY_X*(num+2)/5-23, DISPLAY_Y+5, 14, 6);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* LED error blink
|
||||
*/
|
||||
|
||||
void C64Display::pulse_handler(...)
|
||||
{
|
||||
for (int i=0; i<4; i++)
|
||||
switch (c64_disp->led_state[i]) {
|
||||
case LED_ERROR_ON:
|
||||
c64_disp->led_state[i] = LED_ERROR_OFF;
|
||||
break;
|
||||
case LED_ERROR_OFF:
|
||||
c64_disp->led_state[i] = LED_ERROR_ON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw speedometer
|
||||
*/
|
||||
|
||||
void C64Display::Speedometer(int speed)
|
||||
{
|
||||
static int delay = 0;
|
||||
|
||||
if (delay >= 20) {
|
||||
char str[16];
|
||||
sprintf(str, "%d%%", speed);
|
||||
XSetForeground(display, led_gc, fill_gray.pixel);
|
||||
XFillRectangle(display,mywin, led_gc, 1, DISPLAY_Y+1, DISPLAY_X/5-2, 14);
|
||||
XSetForeground(display, led_gc, black.pixel);
|
||||
XDrawString(display, mywin, led_gc, 24, DISPLAY_Y+12, str, strlen(str));
|
||||
delay = 0;
|
||||
} else
|
||||
delay++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return pointer to bitmap data
|
||||
*/
|
||||
|
||||
uint8 *C64Display::BitmapBase(void)
|
||||
{
|
||||
return (uint8 *)bufmem;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return number of bytes per row
|
||||
*/
|
||||
|
||||
int C64Display::BitmapXMod(void)
|
||||
{
|
||||
return hsize;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll the keyboard
|
||||
*/
|
||||
|
||||
void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||
{
|
||||
static bool auto_rep = true;
|
||||
for(;;) {
|
||||
XEvent event;
|
||||
if (!XCheckMaskEvent(display, eventmask, &event))
|
||||
break;
|
||||
|
||||
switch(event.type) {
|
||||
|
||||
case KeyPress: {
|
||||
int kc = keycode2c64((XKeyEvent *)&event);
|
||||
if (kc == -1)
|
||||
break;
|
||||
switch (kc) {
|
||||
|
||||
case KEY_F9: // F9: Invoke SAM
|
||||
SAM(TheC64);
|
||||
break;
|
||||
|
||||
case KEY_F10: // F10: Quit
|
||||
quit_requested = true;
|
||||
break;
|
||||
|
||||
case KEY_F11: // F11: NMI (Restore)
|
||||
TheC64->NMI();
|
||||
break;
|
||||
|
||||
case KEY_F12: // F12: Reset
|
||||
TheC64->Reset();
|
||||
break;
|
||||
|
||||
case KEY_NUM_LOCK: // NumLock: Toggle joyport
|
||||
num_locked = true;
|
||||
break;
|
||||
|
||||
case KEY_FIRE:
|
||||
joystate &= ~0x10;
|
||||
break;
|
||||
case KEY_JD:
|
||||
joystate &= ~0x02;
|
||||
break;
|
||||
case KEY_JU:
|
||||
joystate &= ~0x01;
|
||||
break;
|
||||
case KEY_JL:
|
||||
joystate &= ~0x04;
|
||||
break;
|
||||
case KEY_JR:
|
||||
joystate &= ~0x08;
|
||||
break;
|
||||
case KEY_JUL:
|
||||
joystate &= ~0x05;
|
||||
break;
|
||||
case KEY_JUR:
|
||||
joystate &= ~0x09;
|
||||
break;
|
||||
case KEY_JDL:
|
||||
joystate &= ~0x06;
|
||||
break;
|
||||
case KEY_JDR:
|
||||
joystate &= ~0x0a;
|
||||
break;
|
||||
|
||||
case KEY_KP_PLUS: // '+' on keypad: Increase SkipFrames
|
||||
ThePrefs.SkipFrames++;
|
||||
break;
|
||||
|
||||
case KEY_KP_MINUS: // '-' on keypad: Decrease SkipFrames
|
||||
if (ThePrefs.SkipFrames > 1)
|
||||
ThePrefs.SkipFrames--;
|
||||
break;
|
||||
|
||||
case KEY_KP_MULT: // '*' on keypad: Toggle speed limiter
|
||||
ThePrefs.LimitSpeed = !ThePrefs.LimitSpeed;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (keystate[kc])
|
||||
break;
|
||||
keystate[kc] = 1;
|
||||
int c64_byte, c64_bit, shifted;
|
||||
c64_byte = kc >> 3;
|
||||
c64_bit = kc & 7;
|
||||
shifted = kc & 128;
|
||||
c64_byte &= 7;
|
||||
if (shifted) {
|
||||
key_matrix[6] &= 0xef;
|
||||
rev_matrix[4] &= 0xbf;
|
||||
}
|
||||
key_matrix[c64_byte] &= ~(1 << c64_bit);
|
||||
rev_matrix[c64_bit] &= ~(1 << c64_byte);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case KeyRelease: {
|
||||
int kc = keycode2c64((XKeyEvent *)&event);
|
||||
if (kc == -1)
|
||||
break;
|
||||
switch (kc) {
|
||||
|
||||
case KEY_NUM_LOCK:
|
||||
num_locked = false;
|
||||
break;
|
||||
|
||||
case KEY_FIRE:
|
||||
joystate |= 0x10;
|
||||
break;
|
||||
case KEY_JD:
|
||||
joystate |= 0x02;
|
||||
break;
|
||||
case KEY_JU:
|
||||
joystate |= 0x01;
|
||||
break;
|
||||
case KEY_JL:
|
||||
joystate |= 0x04;
|
||||
break;
|
||||
case KEY_JR:
|
||||
joystate |= 0x08;
|
||||
break;
|
||||
case KEY_JUL:
|
||||
joystate |= 0x05;
|
||||
break;
|
||||
case KEY_JUR:
|
||||
joystate |= 0x09;
|
||||
break;
|
||||
case KEY_JDL:
|
||||
joystate |= 0x06;
|
||||
break;
|
||||
case KEY_JDR:
|
||||
joystate |= 0x0a;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!keystate[kc])
|
||||
break;
|
||||
keystate[kc] = 0;
|
||||
int c64_byte, c64_bit, shifted;
|
||||
c64_byte = kc >> 3;
|
||||
c64_bit = kc & 7;
|
||||
shifted = kc & 128;
|
||||
c64_byte &= 7;
|
||||
if (shifted) {
|
||||
key_matrix[6] |= 0x10;
|
||||
rev_matrix[4] |= 0x40;
|
||||
}
|
||||
key_matrix[c64_byte] |= (1 << c64_bit);
|
||||
rev_matrix[c64_bit] |= (1 << c64_byte);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case FocusIn:
|
||||
if (auto_rep) {
|
||||
XAutoRepeatOff(display);
|
||||
auto_rep = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
if (!auto_rep) {
|
||||
XAutoRepeatOn(display);
|
||||
auto_rep = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*joystick = joystate;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check if NumLock is down (for switching the joystick keyboard emulation)
|
||||
*/
|
||||
|
||||
bool C64Display::NumLock(void)
|
||||
{
|
||||
return num_locked;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open/close joystick drivers given old and new state of
|
||||
* joystick preferences
|
||||
*/
|
||||
|
||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll joystick port, return CIA mask
|
||||
*/
|
||||
|
||||
uint8 C64::poll_joystick(int port)
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate C64 colors
|
||||
*/
|
||||
|
||||
void C64Display::InitColors(uint8 *colors)
|
||||
{
|
||||
int i;
|
||||
XColor col;
|
||||
char str[20];
|
||||
|
||||
for (i=0; i< 256; i++) {
|
||||
sprintf(str, "rgb:%x/%x/%x", palette_red[i & 0x0f], palette_green[i & 0x0f], palette_blue[i & 0x0f]);
|
||||
XParseColor(display, cmap, str, &col);
|
||||
if (XAllocColor(display, cmap, &col))
|
||||
colors[i] = col.pixel;
|
||||
else
|
||||
fprintf(stderr, "Couldn't get all colors\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a requester (error message)
|
||||
*/
|
||||
|
||||
long int ShowRequester(const char *a, const char *b, const char *)
|
||||
{
|
||||
printf("%s: %s\n", a, b);
|
||||
return 1;
|
||||
}
|
BIN
Src/Frodo.rsrc
BIN
Src/Frodo.rsrc
Binary file not shown.
1031
Src/Frodo_GUI.tcl
1031
Src/Frodo_GUI.tcl
File diff suppressed because it is too large
Load Diff
180
Src/Makefile
180
Src/Makefile
@ -1,180 +0,0 @@
|
||||
b# Makefile.in for Frodo (generic Unix/X11)
|
||||
|
||||
## Version information
|
||||
VERSION = 4
|
||||
REVISION = 3
|
||||
|
||||
## System specific configuration
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
bindir = ${exec_prefix}/bin
|
||||
datadir = ${prefix}/share
|
||||
|
||||
DESTDIR =
|
||||
|
||||
CXX = g++
|
||||
CC = gcc
|
||||
CFLAGS =-DFRODO_SC -O2 -g -I/usr/include/SDL -I$(DEVKITPRO)/libogc/include -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_SDL -DORBIT2=1 -pthread -I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0 -Igui/guichan/include -I./ -DKBD_LANG=0
|
||||
DEFS = -DHAVE_CONFIG_H -DDATADIR=\"$(datadir)/frodo/\" -DBINDIR=\"$(bindir)/\" -DHAVE_SDL
|
||||
LDFLAGS =
|
||||
LIBS = -L/usr/lib -lSDL -lSDL_ttf -pthread -lSDL_image
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
|
||||
## Files
|
||||
GUIOBJS = gui/guichan/actionevent.o gui/guichan/basiccontainer.o gui/guichan/cliprectangle.o gui/guichan/color.o \
|
||||
gui/guichan/defaultfont.o gui/guichan/event.o gui/guichan/exception.o gui/guichan/focushandler.o gui/guichan/font.o \
|
||||
gui/guichan/genericinput.o gui/guichan/graphics.o gui/guichan/guichan.o gui/guichan/gui.o gui/guichan/image.o \
|
||||
gui/guichan/imagefont.o gui/guichan/inputevent.o gui/guichan/key.o gui/guichan/keyevent.o gui/guichan/keyinput.o \
|
||||
gui/guichan/mouseevent.o gui/guichan/mouseinput.o gui/guichan/rectangle.o gui/guichan/sdl/sdl.o \
|
||||
gui/guichan/sdl/sdlgraphics.o gui/guichan/sdl/sdlimage.o gui/guichan/sdl/sdlimageloader.o gui/guichan/sdl/sdlinput.o\
|
||||
gui/guichan/selectionevent.o gui/guichan/widget.o gui/guichan/widgets/button.o gui/guichan/widgets/checkbox.o \
|
||||
gui/guichan/widgets/container.o gui/guichan/widgets/dropdown.o gui/guichan/widgets/icon.o \
|
||||
gui/guichan/widgets/imagebutton.o gui/guichan/widgets/label.o gui/guichan/widgets/listbox.o \
|
||||
gui/guichan/widgets/radiobutton.o gui/guichan/widgets/scrollarea.o gui/guichan/widgets/slider.o \
|
||||
gui/guichan/widgets/tabbedarea.o gui/guichan/widgets/tab.o gui/guichan/widgets/textbox.o \
|
||||
gui/guichan/widgets/textfield.o gui/guichan/widgets/window.o gui/sdlwidgets.o
|
||||
|
||||
OBJS = $(GUIOBJS) main.o Prefs.o SID.o REU.o IEC.o 1541fs.o \
|
||||
1541d64.o 1541t64.o 1541job.o SAM.o CmdPipe.o menu.o Network.o \
|
||||
VirtualKeyboard.o menutexts.o d64-read.o
|
||||
SLOBJS = $(OBJS) C64.o CPUC64.o VIC.o CIA.o CPU1541.o Display.o
|
||||
SLFLAGS = -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=1 -DPC_IS_POINTER=0
|
||||
SCOBJS = $(OBJS) C64_SC.o CPUC64_SC.o VIC_SC.o CIA_SC.o CPU1541_SC.o CPU_common.o Display_SC.o
|
||||
SCFLAGS = -DFRODO_SC
|
||||
GUISRCS =
|
||||
SRCS = $(GUISRCS) main.cpp Display.cpp Prefs.cpp SID.cpp REU.cpp IEC.cpp 1541fs.cpp \
|
||||
1541d64.cpp 1541t64.cpp 1541job.cpp SAM.cpp CmdPipe.cpp C64.cpp \
|
||||
C64_SC.cpp CPUC64.cpp CPUC64_SC.cpp VIC.cpp VIC_SC.cpp CIA.cpp \
|
||||
CIA_SC.cpp CPU1541.cpp CPU1541_PC.cpp CPU1541_SC.cpp CPU_common.cpp \
|
||||
menu.cpp
|
||||
|
||||
## Rules
|
||||
.PHONY: install installdirs uninstall clean distclean depend dep
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .cpp .h
|
||||
|
||||
all: sysconfig.h FrodoSC
|
||||
|
||||
Frodo: $(SLOBJS)
|
||||
$(CXX) -o Frodo $(LDFLAGS) $(SLOBJS) $(LIBS)
|
||||
|
||||
FrodoSC: $(SCOBJS)
|
||||
$(CXX) -o FrodoSC $(LDFLAGS) $(SCOBJS) $(LIBS)
|
||||
|
||||
install: Frodo FrodoSC installdirs
|
||||
$(INSTALL_PROGRAM) Frodo $(DESTDIR)$(bindir)/Frodo
|
||||
$(INSTALL_PROGRAM) FrodoSC $(DESTDIR)$(bindir)/FrodoSC
|
||||
$(INSTALL_PROGRAM) Frodo_GUI.tcl $(DESTDIR)$(bindir)/Frodo_GUI.tcl
|
||||
$(INSTALL_DATA) ../Kernal\ ROM $(DESTDIR)$(datadir)/frodo/Kernal\ ROM
|
||||
$(INSTALL_DATA) glade/Frodo.glade $(DESTDIR)$(datadir)/frodo/Frodo.glade
|
||||
$(INSTALL_DATA) maemo/frodo.desktop $(DESTDIR)$(datadir)/applications/hildon/frodo.desktop
|
||||
$(INSTALL_DATA) maemo/frodo.service $(DESTDIR)$(datadir)/dbus-1/services/frodo.service
|
||||
$(INSTALL_DATA) maemo/frodo.service $(DESTDIR)$(datadir)/dbus-1/services/frodo.service
|
||||
$(INSTALL_DATA) maemo/Frodo_26_26.png $(DESTDIR)$(datadir)/icons/hicolor/26x26/hildon/frodo.png
|
||||
$(INSTALL_DATA) maemo/Frodo_40_40.png $(DESTDIR)$(datadir)/icons/hicolor/40x40/hildon/frodo.png
|
||||
$(INSTALL_DATA) maemo/Frodo_64_64.png $(DESTDIR)$(datadir)/icons/hicolor/scalable/hildon/frodo.png
|
||||
|
||||
installdirs:
|
||||
$(SHELL) mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/frodo $(DESTDIR)$(datadir)/applications/hildon $(DESTDIR)$(datadir)/dbus-1/services $(DESTDIR)$(datadir)/icons/hicolor/26x26/hildon $(DESTDIR)$(datadir)/icons/hicolor/40x40/hildon $(DESTDIR)$(datadir)/icons/hicolor/scalable/hildon
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(bindir)/Frodo
|
||||
rm -f $(DESTDIR)$(bindir)/FrodoSC
|
||||
rm -f $(DESTDIR)$(bindir)/Frodo_GUI.tcl
|
||||
rm -f $(DESTDIR)$(datadir)/frodo/Kernal\ ROM
|
||||
rmdir $(DESTDIR)$(datadir)/frodo
|
||||
|
||||
clean:
|
||||
rm -f $(SLOBJS) $(SCOBJS)
|
||||
rm -f Frodo FrodoSC
|
||||
rm -f core* *.core *~ *.bak
|
||||
|
||||
distclean: clean
|
||||
rm -rf autom4te.cache
|
||||
rm -f Makefile sysconfig.h
|
||||
rm -f config.cache config.log config.status config.h
|
||||
|
||||
depend dep:
|
||||
makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(DEFS) $(CFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(DEFS) $(CFLAGS) -o $@ -c $*.c
|
||||
|
||||
C64.o: C64.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
C64_SC.o: C64_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64.o: CPUC64.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64_SC.o: CPUC64_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
Display_SC.o: Display.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $<
|
||||
|
||||
CPU1541.o: CPU1541.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPU1541_SC.o: CPU1541_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
VIC_SC.o: VIC_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CIA_SC.o: CIA_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
sysconfig.h: sysconfig.h.Host-SDL
|
||||
cp $< $@
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
main.o: sysdeps.h sysconfig.h main.h C64.h Display.h Prefs.h SAM.h
|
||||
main.o: Basic_ROM.h Kernal_ROM.h Char_ROM.h 1541_ROM.h
|
||||
Display.o: sysdeps.h sysconfig.h Display.h main.h Prefs.h Display_SDL.h
|
||||
Display_SC.o: sysdeps.h sysconfig.h Display.h main.h Prefs.h Display_SDL.h
|
||||
Prefs.o: sysdeps.h sysconfig.h Prefs.h Display.h C64.h main.h
|
||||
SID.o: sysdeps.h sysconfig.h SID.h Prefs.h SID_linux.h
|
||||
REU.o: sysdeps.h sysconfig.h REU.h CPUC64.h C64.h Prefs.h
|
||||
IEC.o: sysdeps.h sysconfig.h IEC.h 1541fs.h 1541d64.h 1541t64.h Prefs.h
|
||||
IEC.o: Display.h main.h
|
||||
1541fs.o: sysdeps.h sysconfig.h 1541fs.h IEC.h main.h Prefs.h
|
||||
1541d64.o: sysdeps.h sysconfig.h 1541d64.h IEC.h Prefs.h C64.h main.h debug.h
|
||||
1541t64.o: sysdeps.h sysconfig.h 1541t64.h IEC.h Prefs.h debug.h
|
||||
1541job.o: sysdeps.h sysconfig.h 1541job.h CPU1541.h CIA.h Prefs.h C64.h
|
||||
SAM.o: sysdeps.h sysconfig.h SAM.h C64.h CPUC64.h CPU1541.h CIA.h Prefs.h
|
||||
SAM.o: VIC.h SID.h
|
||||
CmdPipe.o: CmdPipe.h
|
||||
C64.o: sysdeps.h sysconfig.h C64.h CPUC64.h CPU1541.h CIA.h Prefs.h VIC.h C64_SDL.h
|
||||
C64.o: SID.h REU.h IEC.h 1541job.h Display.h
|
||||
C64_SC.o: C64.cpp sysdeps.h sysconfig.h C64.h CPUC64.h CPU1541.h CIA.h C64_SDL.h
|
||||
C64_SC.o: Prefs.h VIC.h SID.h REU.h IEC.h 1541job.h Display.h
|
||||
CPUC64.o: sysdeps.h sysconfig.h CPUC64.h C64.h VIC.h SID.h CIA.h Prefs.h
|
||||
CPUC64.o: REU.h IEC.h Display.h Version.h CPU_emulline.h
|
||||
Network.o: Network.h NetworkUnix.h
|
||||
CPUC64_SC.o: sysdeps.h sysconfig.h CPUC64.h C64.h CPU_common.h VIC.h SID.h
|
||||
CPUC64_SC.o: CIA.h Prefs.h REU.h IEC.h Display.h Version.h CPU_emulcycle.h
|
||||
VIC.o: sysdeps.h sysconfig.h VIC.h C64.h CPUC64.h Display.h Prefs.h
|
||||
VIC_SC.o: sysdeps.h sysconfig.h VIC.h C64.h CPUC64.h Display.h Prefs.h
|
||||
CIA.o: sysdeps.h sysconfig.h CIA.h Prefs.h CPUC64.h C64.h CPU1541.h VIC.h
|
||||
CIA_SC.o: sysdeps.h sysconfig.h CIA.h Prefs.h CPUC64.h C64.h CPU1541.h VIC.h
|
||||
CPU1541.o: sysdeps.h sysconfig.h CPU1541.h CIA.h Prefs.h C64.h 1541job.h
|
||||
CPU1541.o: Display.h CPU_emulline.h
|
||||
CPU1541_SC.o: sysdeps.h sysconfig.h CPU1541.h CIA.h Prefs.h C64.h
|
||||
CPU1541_SC.o: CPU_common.h 1541job.h Display.h CPU_emulcycle.h
|
||||
CPU_common.o: sysdeps.h sysconfig.h CPU_common.h
|
||||
main.o: main_x.h main.cpp main.h
|
||||
menu.o: menu.h
|
||||
gui/sdlwidgets.o: gui/sdl.hpp gui/sdlwidgets.cpp gui/widgets.hpp
|
@ -1,86 +0,0 @@
|
||||
# Makefile for Frodo (AmigaOS with GCC)
|
||||
|
||||
## Version information
|
||||
VERSION = 4
|
||||
REVISION = 2
|
||||
|
||||
CXX = gcc
|
||||
CFLAGS = -O2 -I./ -fomit-frame-pointer -m68040 -m68881
|
||||
LIBRARIES =
|
||||
|
||||
.SUFFIXES: .o .cpp .c .h
|
||||
|
||||
## Files
|
||||
OBJS = main.o Display.o Prefs.o AmigaGUI.o SID.o REU.o IEC.o 1541fs.o \
|
||||
1541d64.o 1541t64.o 1541job.o SAM.o
|
||||
SLOBJS = $(OBJS) C64.o CPUC64.o VIC.o CIA.o CPU1541.o
|
||||
SLFLAGS = -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=1 -DPC_IS_POINTER=0
|
||||
SCOBJS = $(OBJS) C64_SC.o CPUC64_SC.o VIC_SC.o CIA_SC.o CPU1541_SC.o CPU_common.o
|
||||
SCFLAGS = -DFRODO_SC
|
||||
|
||||
Frodo: $(SLOBJS)
|
||||
$(CXX) -o Frodo $(SLOBJS) $(LDFLAGS) $(LIBRARIES)
|
||||
copy Frodo /
|
||||
|
||||
FrodoSC: $(SCOBJS)
|
||||
$(CXX) -o FrodoSC $(SCOBJS) $(LDFLAGS) $(LIBRARIES)
|
||||
copy FrodoSC /
|
||||
|
||||
all: Frodo FrodoSC
|
||||
|
||||
clean:
|
||||
@-delete $(SLOBJS) $(SCOBJS)
|
||||
@-delete -f Frodo FrodoSC
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
.c.o:
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -o $@ -c $*.c
|
||||
|
||||
C64.o: C64.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
C64_SC.o: C64.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64.o: CPUC64.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64_SC.o: CPUC64_SC.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPU1541.o: CPU1541.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPU1541_SC.o: CPU1541_SC.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
VIC_SC.o: VIC_SC.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CIA_SC.o: CIA_SC.cpp
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
## Dependencies
|
||||
main.o: main.cpp main.h main_Amiga.h C64.h Display.h Prefs.h SAM.h
|
||||
C64.o: C64.cpp C64.h C64_Amiga.h CmdPipe.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h REU.h IEC.h 1541job.h Display.h Prefs.h
|
||||
CmdPipe.o: CmdPipe.h
|
||||
Display.o: Display.cpp Display.h Display_Amiga.h main.h Prefs.h Version.h
|
||||
Prefs.o: Prefs.cpp Prefs.h Prefs_Amiga.h Display.h main.h
|
||||
CPUC64.o: CPUC64.cpp CPUC64.h CPU_emulline.h C64.h VIC.h SID.h CIA.h REU.h IEC.h Display.h Version.h
|
||||
CPU1541.o: CPU1541.cpp CPU1541.h CPU_emulline.h 1541job.h C64.h CIA.h Display.h
|
||||
CPU_common.o: CPU_common.cpp CPU_common.h
|
||||
VIC.o: VIC.cpp VIC.h C64.h CPUC64.h Display.h Prefs.h
|
||||
SID.o: SID.cpp SID.h SID_Amiga.h Prefs.h
|
||||
CIA.o: CIA.cpp CIA.h CPUC64.h CPU1541.h VIC.h Prefs.h
|
||||
IEC.o: IEC.cpp IEC.h 1541fs.h 1541d64.h 1541t64.h Prefs.h Display.h
|
||||
1541fs.o: 1541fs.cpp 1541fs.h IEC.h main.h Prefs.h
|
||||
1541fs.h: IEC.h
|
||||
1541d64.o: 1541d64.cpp 1541d64.h IEC.h Prefs.h
|
||||
1541d64.h: IEC.h
|
||||
1541t64.o: 1541t64.cpp 1541t64.h IEC.h Prefs.h
|
||||
1541t64.h: IEC.h
|
||||
1541job.o: 1541job.cpp 1541job.h CPU1541.h Prefs.h
|
||||
REU.o: REU.cpp REU.h CPUC64.h Prefs.h
|
||||
SAM.o: SAM.cpp SAM.h C64.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h
|
@ -1,117 +0,0 @@
|
||||
## BeOS Generic Makefile v2.1 ##
|
||||
|
||||
## Fill in this file to specify the project being created, and the referenced
|
||||
## makefile-engine will do all of the hard work for you. This handles both
|
||||
## Intel and PowerPC builds of the BeOS.
|
||||
|
||||
## Application Specific Settings ---------------------------------------------
|
||||
|
||||
# specify the name of the binary
|
||||
NAME= Frodo
|
||||
|
||||
# specify the type of binary
|
||||
# APP: Application
|
||||
# SHARED: Shared library or add-on
|
||||
# STATIC: Static library archive
|
||||
# DRIVER: Kernel Driver
|
||||
TYPE= APP
|
||||
|
||||
# add support for new Pe and Eddie features
|
||||
# to fill in generic makefile
|
||||
|
||||
#%{
|
||||
# @src->@
|
||||
|
||||
# specify the source files to use
|
||||
# full paths or paths relative to the makefile can be included
|
||||
# all files, regardless of directory, will have their object
|
||||
# files created in the common object directory.
|
||||
# Note that this means this makefile will not work correctly
|
||||
# if two source files with the same name (source.c or source.cpp)
|
||||
# are included from different directories. Also note that spaces
|
||||
# in folder names do not work well with this makefile.
|
||||
SRCS = main.cpp Prefs.cpp SAM.cpp Display.cpp C64.cpp CPUC64.cpp CPU1541.cpp \
|
||||
VIC.cpp SID.cpp CIA.cpp REU.cpp IEC.cpp 1541fs.cpp 1541d64.cpp 1541t64.cpp 1541job.cpp
|
||||
|
||||
# specify the resource files to use
|
||||
# full path or a relative path to the resource file can be used.
|
||||
RSRCS= Frodo.rsrc
|
||||
|
||||
# @<-src@
|
||||
#%}
|
||||
|
||||
# end support for Pe and Eddie
|
||||
|
||||
# specify additional libraries to link against
|
||||
# there are two acceptable forms of library specifications
|
||||
# - if your library follows the naming pattern of:
|
||||
# libXXX.so or libXXX.a you can simply specify XXX
|
||||
# library: libbe.so entry: be
|
||||
#
|
||||
# - if your library does not follow the standard library
|
||||
# naming scheme you need to specify the path to the library
|
||||
# and it's name
|
||||
# library: my_lib.a entry: my_lib.a or path/my_lib.a
|
||||
LIBS=be media game device tracker
|
||||
|
||||
# specify additional paths to directories following the standard
|
||||
# libXXX.so or libXXX.a naming scheme. You can specify full paths
|
||||
# or paths relative to the makefile. The paths included may not
|
||||
# be recursive, so include all of the paths where libraries can
|
||||
# be found. Directories where source files are found are
|
||||
# automatically included.
|
||||
LIBPATHS=
|
||||
|
||||
# additional paths to look for system headers
|
||||
# thes use the form: #include <header>
|
||||
# source file directories are NOT auto-included here
|
||||
SYSTEM_INCLUDE_PATHS =
|
||||
|
||||
# additional paths to look for local headers
|
||||
# thes use the form: #include "header"
|
||||
# source file directories are automatically included
|
||||
LOCAL_INCLUDE_PATHS =
|
||||
|
||||
# specify the level of optimization that you desire
|
||||
# NONE, SOME, FULL
|
||||
OPTIMIZE= FULL
|
||||
|
||||
# specify any preprocessor symbols to be defined. The symbols will not
|
||||
# have their values set automatically; you must supply the value (if any)
|
||||
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
||||
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
|
||||
# would pass "-DDEBUG" on the compiler's command line.
|
||||
DEFINES= PRECISE_CPU_CYCLES=1 PRECISE_CIA_CYCLES=1 PC_IS_POINTER=0
|
||||
|
||||
# specify special warning levels
|
||||
# if unspecified default warnings will be used
|
||||
# NONE = supress all warnings
|
||||
# ALL = enable all warnings
|
||||
WARNINGS =
|
||||
|
||||
# specify whether image symbols will be created
|
||||
# so that stack crawls in the debugger are meaningful
|
||||
# if TRUE symbols will be created
|
||||
SYMBOLS =
|
||||
|
||||
# specify debug settings
|
||||
# if TRUE will allow application to be run from
|
||||
# a source-level debugger
|
||||
DEBUGGER =
|
||||
|
||||
# specify additional compiler flags for all files
|
||||
COMPILER_FLAGS =
|
||||
|
||||
# specify additional linker flags
|
||||
LINKER_FLAGS =
|
||||
|
||||
|
||||
## include the makefile-engine
|
||||
include /boot/develop/etc/makefile-engine
|
||||
|
||||
|
||||
## Custom stuff for Frodo
|
||||
sysconfig.h: sysconfig.h.Be
|
||||
ln -s sysconfig.h.Be sysconfig.h
|
||||
|
||||
main.cpp: sysconfig.h
|
@ -1,118 +0,0 @@
|
||||
## BeOS Generic Makefile v2.1 ##
|
||||
|
||||
## Fill in this file to specify the project being created, and the referenced
|
||||
## makefile-engine will do all of the hard work for you. This handles both
|
||||
## Intel and PowerPC builds of the BeOS.
|
||||
|
||||
## Application Specific Settings ---------------------------------------------
|
||||
|
||||
# specify the name of the binary
|
||||
NAME= FrodoSC
|
||||
|
||||
# specify the type of binary
|
||||
# APP: Application
|
||||
# SHARED: Shared library or add-on
|
||||
# STATIC: Static library archive
|
||||
# DRIVER: Kernel Driver
|
||||
TYPE= APP
|
||||
|
||||
# add support for new Pe and Eddie features
|
||||
# to fill in generic makefile
|
||||
|
||||
#%{
|
||||
# @src->@
|
||||
|
||||
# specify the source files to use
|
||||
# full paths or paths relative to the makefile can be included
|
||||
# all files, regardless of directory, will have their object
|
||||
# files created in the common object directory.
|
||||
# Note that this means this makefile will not work correctly
|
||||
# if two source files with the same name (source.c or source.cpp)
|
||||
# are included from different directories. Also note that spaces
|
||||
# in folder names do not work well with this makefile.
|
||||
SRCS = main.cpp Prefs.cpp SAM.cpp Display.cpp C64_SC.cpp CPUC64_SC.cpp CPU1541_SC.cpp \
|
||||
CPU_common.cpp VIC_SC.cpp SID.cpp CIA_SC.cpp REU.cpp IEC.cpp 1541fs.cpp 1541d64.cpp \
|
||||
1541t64.cpp 1541job.cpp
|
||||
|
||||
# specify the resource files to use
|
||||
# full path or a relative path to the resource file can be used.
|
||||
RSRCS= Frodo.rsrc
|
||||
|
||||
# @<-src@
|
||||
#%}
|
||||
|
||||
# end support for Pe and Eddie
|
||||
|
||||
# specify additional libraries to link against
|
||||
# there are two acceptable forms of library specifications
|
||||
# - if your library follows the naming pattern of:
|
||||
# libXXX.so or libXXX.a you can simply specify XXX
|
||||
# library: libbe.so entry: be
|
||||
#
|
||||
# - if your library does not follow the standard library
|
||||
# naming scheme you need to specify the path to the library
|
||||
# and it's name
|
||||
# library: my_lib.a entry: my_lib.a or path/my_lib.a
|
||||
LIBS=be media game device tracker
|
||||
|
||||
# specify additional paths to directories following the standard
|
||||
# libXXX.so or libXXX.a naming scheme. You can specify full paths
|
||||
# or paths relative to the makefile. The paths included may not
|
||||
# be recursive, so include all of the paths where libraries can
|
||||
# be found. Directories where source files are found are
|
||||
# automatically included.
|
||||
LIBPATHS=
|
||||
|
||||
# additional paths to look for system headers
|
||||
# thes use the form: #include <header>
|
||||
# source file directories are NOT auto-included here
|
||||
SYSTEM_INCLUDE_PATHS =
|
||||
|
||||
# additional paths to look for local headers
|
||||
# thes use the form: #include "header"
|
||||
# source file directories are automatically included
|
||||
LOCAL_INCLUDE_PATHS =
|
||||
|
||||
# specify the level of optimization that you desire
|
||||
# NONE, SOME, FULL
|
||||
OPTIMIZE= FULL
|
||||
|
||||
# specify any preprocessor symbols to be defined. The symbols will not
|
||||
# have their values set automatically; you must supply the value (if any)
|
||||
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
||||
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
|
||||
# would pass "-DDEBUG" on the compiler's command line.
|
||||
DEFINES= FRODO_SC
|
||||
|
||||
# specify special warning levels
|
||||
# if unspecified default warnings will be used
|
||||
# NONE = supress all warnings
|
||||
# ALL = enable all warnings
|
||||
WARNINGS =
|
||||
|
||||
# specify whether image symbols will be created
|
||||
# so that stack crawls in the debugger are meaningful
|
||||
# if TRUE symbols will be created
|
||||
SYMBOLS =
|
||||
|
||||
# specify debug settings
|
||||
# if TRUE will allow application to be run from
|
||||
# a source-level debugger
|
||||
DEBUGGER =
|
||||
|
||||
# specify additional compiler flags for all files
|
||||
COMPILER_FLAGS =
|
||||
|
||||
# specify additional linker flags
|
||||
LINKER_FLAGS =
|
||||
|
||||
|
||||
## include the makefile-engine
|
||||
include /boot/develop/etc/makefile-engine
|
||||
|
||||
|
||||
## Custom stuff for Frodo
|
||||
sysconfig.h: sysconfig.h.Be
|
||||
ln -s sysconfig.h.Be sysconfig.h
|
||||
|
||||
main.cpp: sysconfig.h
|
@ -1,111 +0,0 @@
|
||||
# Makefile for Frodo (WIN32 DirectX with MSVC++)
|
||||
|
||||
## Version information
|
||||
VERSION = 4
|
||||
REVISION = 2
|
||||
|
||||
# Choose static (L) or dynamic (D) version of C library
|
||||
LIBC = L
|
||||
#LIBC = D
|
||||
|
||||
# Choose debug or optimized build
|
||||
#CFLAGS = -W2 -Zi -DDEBUG -D_DEBUG -M$(LIBC)d
|
||||
CFLAGS = -Ox2 -G5 -Gi- -FAsc -M$(LIBC)
|
||||
|
||||
CXX = cl
|
||||
RC = rc
|
||||
ALLCFLAGS = -I. -DWIN32 -DSTRICT -D__i386 $(CFLAGS)
|
||||
ALLSCCFLAGS = -DFRODO_SC -DBATCH_CIA_CYCLES $(ALLCFLAGS)
|
||||
#ALLSCCFLAGS = -DFRODO_SC $(ALLCFLAGS)
|
||||
ALLPCCFLAGS = -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=1 -DPC_IS_POINTER=0 $(ALLCFLAGS)
|
||||
LDFLAGS = $(ALLCFLAGS)
|
||||
LIBRARIES = user32.lib kernel32.lib gdi32.lib ddraw.lib dsound.lib winmm.lib comctl32.lib comdlg32.lib shell32.lib
|
||||
#PROFILE = /link /profile
|
||||
|
||||
## Files
|
||||
OBJS = main.obj Display.obj Prefs.obj SID.obj REU.obj IEC.obj 1541fs.obj \
|
||||
1541d64.obj 1541t64.obj 1541job.obj SAM.obj ndir.obj Frodo.res
|
||||
SLOBJS = $(OBJS) C64.obj CPUC64.obj VIC.obj CIA.obj CPU1541.obj
|
||||
SCOBJS = $(OBJS) C64_SC.obj CPUC64_SC.obj VIC_SC.obj CIA_SC.obj CPU1541_SC.obj CPU_common.obj
|
||||
PCOBJS = $(OBJS) C64_PC.obj CPUC64_PC.obj VIC.obj CIA.obj CPU1541_PC.obj
|
||||
|
||||
Frodo: Frodo.exe
|
||||
|
||||
Frodo.exe: $(SLOBJS)
|
||||
$(CXX) -FeFrodo.exe $(SLOBJS) $(LDFLAGS) $(LIBRARIES)
|
||||
copy Frodo.exe ..
|
||||
|
||||
FrodoSC: FrodoSC.exe
|
||||
|
||||
FrodoSC.exe: $(SCOBJS)
|
||||
$(CXX) -FeFrodoSC.exe $(SCOBJS) $(LDFLAGS) $(LIBRARIES) $(PROFILE)
|
||||
copy FrodoSC.exe ..
|
||||
|
||||
FrodoPC: FrodoPC.exe
|
||||
|
||||
FrodoPC.exe: $(PCOBJS)
|
||||
$(CXX) -FeFrodoPC.exe $(PCOBJS) $(LDFLAGS) $(LIBRARIES)
|
||||
copy FrodoPC.exe ..
|
||||
|
||||
Frodo.res: Frodo.rc Frodo.ico
|
||||
$(RC) Frodo.rc
|
||||
|
||||
all: Frodo FrodoSC FrodoPC
|
||||
|
||||
clean:
|
||||
rm -f $(SLOBJS) $(SCOBJS) $(PCOBJS)
|
||||
rm -f Frodo.exe FrodoSC.exe FrodoPC.exe
|
||||
rm -f *.ilk *.pdb *.cod *.nms *.res *.aps
|
||||
|
||||
.cpp.obj:
|
||||
$(CXX) $(ALLCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
.c.obj:
|
||||
$(CXX) $(ALLCFLAGS) -o $@ -c $*.c
|
||||
|
||||
C64_SC.obj: C64.cpp C64.h C64_WIN32.h CmdPipe.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h REU.h IEC.h 1541job.h Display.h Prefs.h
|
||||
$(CXX) $(ALLSCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
CPUC64_SC.obj: CPUC64_SC.cpp CPUC64.h CPU_emulcycle.h CPU_common.h C64.h VIC.h SID.h CIA.h REU.h IEC.h Display.h Version.h
|
||||
$(CXX) $(ALLSCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
CPU1541_SC.obj: CPU1541_SC.cpp CPU1541.h CPU_emulcycle.h CPU_common.h 1541job.h C64.h CIA.h Display.h
|
||||
$(CXX) $(ALLSCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
VIC_SC.obj: VIC_SC.cpp VIC.h C64.h CPUC64.h Display.h Prefs.h
|
||||
$(CXX) $(ALLSCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
CIA_SC.obj: CIA_SC.cpp CIA.h CPUC64.h CPU1541.h VIC.h Prefs.h
|
||||
$(CXX) $(ALLSCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
C64_PC.obj: C64.cpp C64.h C64_WIN32.h CmdPipe.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h REU.h IEC.h 1541job.h Display.h Prefs.h
|
||||
$(CXX) $(ALLPCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
CPUC64_PC.obj: CPUC64.cpp CPUC64.h CPU_emulline.h CPU_common.h C64.h VIC.h SID.h CIA.h REU.h IEC.h Display.h Version.h
|
||||
$(CXX) $(ALLPCCFLAGS) -DPC_IS_POINTER=0 -Fo$@ -c $*.cpp
|
||||
|
||||
CPU1541_PC.obj: CPU1541_PC.cpp CPU1541.h CPU_emulline.h CPU_common.h 1541job.h C64.h CIA.h Display.h
|
||||
$(CXX) $(ALLPCCFLAGS) -Fo$@ -c $*.cpp
|
||||
|
||||
## Dependencies
|
||||
main.obj: main.cpp main.h main_WIN32.h C64.h Display.h Prefs.h SAM.h
|
||||
C64.obj: C64.cpp C64.h C64_WIN32.h CmdPipe.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h REU.h IEC.h 1541job.h Display.h Prefs.h
|
||||
CmdPipe.obj: CmdPipe.h
|
||||
Display.obj: Display.cpp Display.h Display_WIN32.h main.h Prefs.h Version.h resource.h
|
||||
Prefs.obj: Prefs.cpp Prefs.h Prefs_WIN32.h Display.h main.h resource.h
|
||||
CPUC64.obj: CPUC64.cpp CPUC64.h CPU_emulline.h C64.h VIC.h SID.h CIA.h REU.h IEC.h Display.h Version.h
|
||||
CPU1541.obj: CPU1541.cpp CPU1541.h CPU_emulline.h 1541job.h C64.h CIA.h Display.h
|
||||
CPU_common.obj: CPU_common.cpp CPU_common.h
|
||||
VIC.obj: VIC.cpp VIC.h C64.h CPUC64.h Display.h Prefs.h
|
||||
SID.obj: SID.cpp SID.h SID_WIN32.h Prefs.h main.h
|
||||
CIA.obj: CIA.cpp CIA.h CPUC64.h CPU1541.h VIC.h Prefs.h
|
||||
IEC.obj: IEC.cpp IEC.h 1541fs.h 1541d64.h 1541t64.h Prefs.h Display.h
|
||||
1541fs.obj: 1541fs.cpp 1541fs.h IEC.h main.h Prefs.h
|
||||
1541fs.h: IEC.h
|
||||
1541d64.obj: 1541d64.cpp 1541d64.h IEC.h Prefs.h
|
||||
1541d64.h: IEC.h
|
||||
1541t64.obj: 1541t64.cpp 1541t64.h IEC.h Prefs.h
|
||||
1541t64.h: IEC.h
|
||||
1541job.obj: 1541job.cpp 1541job.h CPU1541.h Prefs.h
|
||||
REU.obj: REU.cpp REU.h CPUC64.h Prefs.h
|
||||
SAM.obj: SAM.cpp SAM.h C64.h CPUC64.h CPU1541.h VIC.h SID.h CIA.h
|
118
Src/Makefile.in
118
Src/Makefile.in
@ -1,118 +0,0 @@
|
||||
# Makefile.in for Frodo (generic Unix/X11)
|
||||
|
||||
## Version information
|
||||
VERSION = 4
|
||||
REVISION = 3
|
||||
|
||||
## System specific configuration
|
||||
@SET_MAKE@
|
||||
SHELL = /bin/sh
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
datadir = @datadir@
|
||||
|
||||
DESTDIR =
|
||||
|
||||
CXX = @CXX@
|
||||
CFLAGS = @CFLAGS@ @GLADE_CFLAGS@ @OSSO_CFLAGS@ -I./ -DKBD_LANG=@KBD_LANG@
|
||||
DEFS = @DEFS@ -DDATADIR=\"$(datadir)/frodo/\" -DBINDIR=\"$(bindir)/\"
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@ @GLADE_LIBS@ @OSSO_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
## Files
|
||||
GUIOBJS = @GUIOBJS@
|
||||
OBJS = $(GUIOBJS) main.o Display.o Prefs.o SID.o REU.o IEC.o 1541fs.o \
|
||||
1541d64.o 1541t64.o 1541job.o SAM.o CmdPipe.o
|
||||
SLOBJS = $(OBJS) C64.o CPUC64.o VIC.o CIA.o CPU1541.o
|
||||
SLFLAGS = -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=1 -DPC_IS_POINTER=0
|
||||
SCOBJS = $(OBJS) C64_SC.o CPUC64_SC.o VIC_SC.o CIA_SC.o CPU1541_SC.o CPU_common.o
|
||||
SCFLAGS = -DFRODO_SC
|
||||
GUISRCS = @GUISRCS@
|
||||
SRCS = $(GUISRCS) main.cpp Display.cpp Prefs.cpp SID.cpp REU.cpp IEC.cpp 1541fs.cpp \
|
||||
1541d64.cpp 1541t64.cpp 1541job.cpp SAM.cpp CmdPipe.cpp C64.cpp \
|
||||
C64_SC.cpp CPUC64.cpp CPUC64_SC.cpp VIC.cpp VIC_SC.cpp CIA.cpp \
|
||||
CIA_SC.cpp CPU1541.cpp CPU1541_PC.cpp CPU1541_SC.cpp CPU_common.cpp
|
||||
|
||||
## Rules
|
||||
.PHONY: install installdirs uninstall clean distclean depend dep
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .cpp .h
|
||||
|
||||
all: Frodo FrodoSC
|
||||
|
||||
Frodo: $(SLOBJS)
|
||||
$(CXX) -o Frodo $(LDFLAGS) $(SLOBJS) $(LIBS)
|
||||
|
||||
FrodoSC: $(SCOBJS)
|
||||
$(CXX) -o FrodoSC $(LDFLAGS) $(SCOBJS) $(LIBS)
|
||||
|
||||
install: Frodo FrodoSC installdirs
|
||||
$(INSTALL_PROGRAM) Frodo $(DESTDIR)$(bindir)/Frodo
|
||||
$(INSTALL_PROGRAM) FrodoSC $(DESTDIR)$(bindir)/FrodoSC
|
||||
$(INSTALL_PROGRAM) Frodo_GUI.tcl $(DESTDIR)$(bindir)/Frodo_GUI.tcl
|
||||
$(INSTALL_DATA) ../Kernal\ ROM $(DESTDIR)$(datadir)/frodo/Kernal\ ROM
|
||||
$(INSTALL_DATA) glade/Frodo.glade $(DESTDIR)$(datadir)/frodo/Frodo.glade
|
||||
$(INSTALL_DATA) maemo/frodo.desktop $(DESTDIR)$(datadir)/applications/hildon/frodo.desktop
|
||||
$(INSTALL_DATA) maemo/frodo.service $(DESTDIR)$(datadir)/dbus-1/services/frodo.service
|
||||
$(INSTALL_DATA) maemo/frodo.service $(DESTDIR)$(datadir)/dbus-1/services/frodo.service
|
||||
$(INSTALL_DATA) maemo/Frodo_26_26.png $(DESTDIR)$(datadir)/icons/hicolor/26x26/hildon/frodo.png
|
||||
$(INSTALL_DATA) maemo/Frodo_40_40.png $(DESTDIR)$(datadir)/icons/hicolor/40x40/hildon/frodo.png
|
||||
$(INSTALL_DATA) maemo/Frodo_64_64.png $(DESTDIR)$(datadir)/icons/hicolor/scalable/hildon/frodo.png
|
||||
|
||||
installdirs:
|
||||
$(SHELL) mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/frodo $(DESTDIR)$(datadir)/applications/hildon $(DESTDIR)$(datadir)/dbus-1/services $(DESTDIR)$(datadir)/icons/hicolor/26x26/hildon $(DESTDIR)$(datadir)/icons/hicolor/40x40/hildon $(DESTDIR)$(datadir)/icons/hicolor/scalable/hildon
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(bindir)/Frodo
|
||||
rm -f $(DESTDIR)$(bindir)/FrodoSC
|
||||
rm -f $(DESTDIR)$(bindir)/Frodo_GUI.tcl
|
||||
rm -f $(DESTDIR)$(datadir)/frodo/Kernal\ ROM
|
||||
rmdir $(DESTDIR)$(datadir)/frodo
|
||||
|
||||
clean:
|
||||
rm -f $(SLOBJS) $(SCOBJS)
|
||||
rm -f Frodo FrodoSC
|
||||
rm -f core* *.core *~ *.bak
|
||||
|
||||
distclean: clean
|
||||
rm -rf autom4te.cache
|
||||
rm -f Makefile sysconfig.h
|
||||
rm -f config.cache config.log config.status config.h
|
||||
|
||||
depend dep:
|
||||
makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(DEFS) $(CFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
C64.o: C64.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
C64_SC.o: C64_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64.o: CPUC64.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPUC64_SC.o: CPUC64_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPU1541.o: CPU1541.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SLFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CPU1541_SC.o: CPU1541_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
VIC_SC.o: VIC_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
CIA_SC.o: CIA_SC.cpp
|
||||
$(CXX) $(DEFS) $(CFLAGS) $(SCFLAGS) -o $@ -c $*.cpp
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
132
Src/MakefileRO
132
Src/MakefileRO
@ -1,132 +0,0 @@
|
||||
# Makefile for Frodo (RISC OS with GCC)
|
||||
|
||||
## Version information
|
||||
VERSION = 4
|
||||
REVISION = 2
|
||||
|
||||
CXX = gcc
|
||||
CFLAGS = -O2
|
||||
CFLAGSO = -O3
|
||||
SCFLAGS = -O2 -DFRODO_SC
|
||||
SCFLAGSO = -O3 -DFRODO_SC
|
||||
|
||||
LIBRARIES = GCC:o.libgcc C:o.stubs
|
||||
LINK = drlink
|
||||
ASS = as
|
||||
|
||||
## Files
|
||||
OBJS = o.Prefs o.REU o.IEC o.1541fs o.1541d64 o.1541t64 o.1541job o.SAM o.ROlib
|
||||
SLOBJS = $(OBJS) o.C64 o.CPUC64 o.VIC o.CIA o.CPU1541 o.Display o.SID o.main o.AcornGUI
|
||||
SCOBJS = $(OBJS) o.C64_SC o.CPUC64_SC o.VIC_SC o.CIA_SC o.CPU1541_SC o.CPU_common o.Display_SC\
|
||||
o.main_SC o.SID_SC o.AcornGUI_SC
|
||||
|
||||
all: Frodo FrodoSC
|
||||
|
||||
Frodo: $(SLOBJS)
|
||||
$(LINK) -o Frodo $(LIBRARIES) $(SLOBJS) $(LDFLAGS)
|
||||
|
||||
FrodoPC: $(PCOBJS)
|
||||
$(LINK) -o FrodoPC $(LIBRARIES) $(PCOBJS) $(LDFLAGS)
|
||||
|
||||
|
||||
# SC objects
|
||||
o.C64_SC: cc.C64_SC h.C64 i.C64_Acorn h.CPUC64 h.CPU1541 h.VIC h.SID h.CIA h.REU \
|
||||
h.IEC h.1541job h.Display h.Prefs h.ROlib h.AcornGUI i.OldSnap
|
||||
$(CXX) $(INCLUDES) $(SCFLAGS) -c C64_SC.cc
|
||||
|
||||
o.CPUC64_SC: cc.CPUC64_SC h.CPUC64 i.CPU_emulcycle h.CPU_common h.C64 h.VIC h.SID h.CIA \
|
||||
h.REU h.IEC h.Display h.Version h.ROlib
|
||||
$(CXX) $(INCLUDES) $(SCFLAGSO) -c CPUC64_SC.cc
|
||||
|
||||
o.CPU1541_SC: cc.CPU1541_SC h.CPU1541 i.CPU_emulcycle h.CPU_common h.1541job h.C64 h.CIA \
|
||||
h.Display h.ROlib
|
||||
$(CXX) $(INCLUDES) $(SCFLAGSO) -c CPU1541_SC.cc
|
||||
|
||||
o.VIC_SC: cc.VIC_SC h.VIC h.C64 h.CPUC64 h.Display h.Prefs h.ROlib
|
||||
$(CXX) $(INCLUDES) $(SCFLAGSO) -c VIC_SC.cc
|
||||
|
||||
o.CIA_SC: cc.CIA_SC h.CIA h.CPUC64 h.CPU1541 h.VIC h.Prefs
|
||||
$(CXX) $(INCLUDES) $(SCFLAGSO) -c CIA_SC.cc
|
||||
|
||||
## These were added for RISC OS -- same source code, but different object files needed!
|
||||
o.main_SC: cc.main_SC cc.main h.main i.main_Acorn h.C64 h.Display h.Prefs h.SAM h.ROlib\
|
||||
h.AcornGUI
|
||||
$(CXX) $(INCLUDES) $(SCFLAGS) -c main_SC.cc
|
||||
|
||||
o.Display_SC: cc.Display_SC cc.Display h.Display i.Display_Acorn h.main h.Prefs h.Version\
|
||||
h.ROlib h.C64 h.AcornGUI h.VIC
|
||||
$(CXX) $(INCLUDES) $(SCFLAGS) -c Display_SC.cc
|
||||
|
||||
o.SID_SC: cc.SID_SC cc.SID h.SID i.SID_Acorn h.Prefs h.ROlib h.C64 i.FixPoint
|
||||
$(CXX) $(INCLUDES) $(SCFLAGSO) -c SID_SC.cc
|
||||
|
||||
o.AcornGUI_SC: cc.AcornGUI_SC cc.AcornGUI h.AcornGUI h.ROlib h.main h.Prefs h.C64 h.VIC\
|
||||
h.Version
|
||||
$(CXX) $(INCLUDES) $(SCFLAGS) -c AcornGUI_SC.cc
|
||||
|
||||
## Dependencies
|
||||
o.main: cc.main h.main i.main_Acorn h.C64 h.Display h.Prefs h.SAM h.ROlib h.AcornGUI
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c main.cc
|
||||
|
||||
o.C64: cc.C64 h.C64 i.C64_Acorn h.CPUC64 h.CPU1541 h.VIC h.SID h.CIA \
|
||||
h.REU h.IEC h.1541job h.Display h.Prefs h.ROlib h.AcornGUI i.OldSnap
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c C64.cc
|
||||
|
||||
o.Display: cc.Display h.Display i.Display_Acorn h.main h.Prefs h.Version h.ROlib h.C64\
|
||||
h.AcornGUI h.VIC
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c Display.cc
|
||||
|
||||
o.Prefs: cc.Prefs h.Prefs h.Display h.main h.ROlib
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c Prefs.cc
|
||||
|
||||
o.CPUC64: cc.CPUC64 h.CPUC64 i.CPU_emulline h.C64 h.VIC h.SID h.CIA h.REU h.IEC \
|
||||
h.Display h.Version h.ROlib
|
||||
$(CXX) $(INCLUDES) $(CFLAGSO) -c CPUC64.cc
|
||||
|
||||
o.CPU1541: cc.CPU1541 h.CPU1541 i.CPU_emulline h.1541job h.C64 h.CIA h.Display h.ROlib
|
||||
$(CXX) $(INCLUDES) $(CFLAGSO) -c CPU1541.cc
|
||||
|
||||
o.CPU_common: cc.CPU_common h.CPU_common
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c CPU_common.cc
|
||||
|
||||
o.VIC: cc.VIC h.VIC h.C64 h.CPUC64 h.Display h.Prefs h.ROlib i.el_Acorn
|
||||
$(CXX) $(INCLUDES) $(CFLAGSO) -c VIC.cc
|
||||
|
||||
o.SID: cc.SID h.SID i.SID_Acorn h.Prefs h.ROlib h.C64 i.FixPoint
|
||||
$(CXX) $(INCLUDES) $(CFLAGSO) -c SID.cc
|
||||
|
||||
o.CIA: cc.CIA h.CIA h.CPUC64 h.CPU1541 h.VIC h.Prefs
|
||||
$(CXX) $(INCLUDES) $(CFLAGSO) -c CIA.cc
|
||||
|
||||
o.IEC: cc.IEC h.IEC h.1541fs h.1541d64 h.1541t64 h.Prefs h.Display h.ROlib
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c IEC.cc
|
||||
|
||||
o.1541fs: cc.1541fs h.1541fs h.IEC h.main h.Prefs h.ROlib
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c 1541fs.cc
|
||||
|
||||
h.1541fs: h.IEC
|
||||
|
||||
o.1541d64: cc.1541d64 h.1541d64 h.IEC h.Prefs
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c 1541d64.cc
|
||||
|
||||
h.1541d64: h.IEC
|
||||
|
||||
o.1541t64: cc.1541t64 h.1541t64 h.IEC h.Prefs
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c 1541t64.cc
|
||||
|
||||
h.1541t64: h.IEC
|
||||
|
||||
o.1541job: cc.1541job h.1541job h.CPU1541 h.Prefs
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c 1541job.cc
|
||||
|
||||
o.REU: cc.REU h.REU h.CPUC64 h.Prefs
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c REU.cc
|
||||
|
||||
o.SAM: cc.SAM h.SAM h.C64 h.CPUC64 h.CPU1541 h.VIC h.SID h.CIA
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c SAM.cc
|
||||
|
||||
o.ROlib: s.ROlib
|
||||
$(ASS) -o o.ROlib s.ROlib
|
||||
|
||||
o.AcornGUI: cc.AcornGUI h.AcornGUI h.ROlib h.main h.Display h.Prefs h.Version h.C64 h.VIC
|
||||
$(CXX) $(INCLUDES) $(CFLAGS) -c AcornGUI.cc
|
@ -1,397 +0,0 @@
|
||||
/*
|
||||
* Prefs_Amiga.h - Global preferences, Amiga specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <intuition/intuition.h>
|
||||
#include <intuition/gadgetclass.h>
|
||||
#include <libraries/asl.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/gadtools.h>
|
||||
#include <proto/asl.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
extern "C" {
|
||||
#include "AmigaGUI.h"
|
||||
}
|
||||
|
||||
|
||||
// Flag: All done, close prefs window
|
||||
static bool done, result;
|
||||
|
||||
// Pointer to preferences being edited
|
||||
static Prefs *prefs;
|
||||
|
||||
// Pointer to prefs file name
|
||||
static char *path;
|
||||
|
||||
// File requesters
|
||||
struct FileRequester *open_req, *save_req, *drive_req;
|
||||
|
||||
// Prototypes
|
||||
static void set_values(void);
|
||||
static void get_values(void);
|
||||
static void ghost_gadgets(void);
|
||||
static void get_drive(int i);
|
||||
|
||||
|
||||
/*
|
||||
* Show preferences editor (synchronously)
|
||||
* prefs_name points to the file name of the preferences (which may be changed)
|
||||
*/
|
||||
|
||||
bool Prefs::ShowEditor(bool startup, char *prefs_name)
|
||||
{
|
||||
done = result = FALSE;
|
||||
prefs = this;
|
||||
path = prefs_name;
|
||||
open_req = save_req = NULL;
|
||||
|
||||
// Open prefs window
|
||||
if (!SetupScreen()) {
|
||||
if (!OpenPrefsWindow()) {
|
||||
|
||||
// Allocate file requesters
|
||||
open_req = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_Window, (ULONG)PrefsWnd,
|
||||
ASLFR_SleepWindow, TRUE,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Open preferences...",
|
||||
ASLFR_RejectIcons, TRUE,
|
||||
TAG_DONE);
|
||||
save_req = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_Window, (ULONG)PrefsWnd,
|
||||
ASLFR_SleepWindow, TRUE,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Save preferences as...",
|
||||
ASLFR_DoSaveMode, TRUE,
|
||||
ASLFR_RejectIcons, TRUE,
|
||||
TAG_DONE);
|
||||
drive_req = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_Window, (ULONG)PrefsWnd,
|
||||
ASLFR_SleepWindow, TRUE,
|
||||
ASLFR_RejectIcons, TRUE,
|
||||
TAG_DONE);
|
||||
|
||||
// Handle prefs window
|
||||
set_values();
|
||||
while (!done) {
|
||||
WaitPort(PrefsWnd->UserPort);
|
||||
HandlePrefsIDCMP();
|
||||
}
|
||||
|
||||
// Free file requesters
|
||||
FreeAslRequest(open_req);
|
||||
FreeAslRequest(save_req);
|
||||
FreeAslRequest(drive_req);
|
||||
}
|
||||
ClosePrefsWindow();
|
||||
}
|
||||
CloseDownScreen();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the values of the gadgets
|
||||
*/
|
||||
|
||||
static void set_values(void)
|
||||
{
|
||||
prefs->Check();
|
||||
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_NormalCycles], PrefsWnd, NULL, GTIN_Number, prefs->NormalCycles, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_BadLineCycles], PrefsWnd, NULL, GTIN_Number, prefs->BadLineCycles, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_CIACycles], PrefsWnd, NULL, GTIN_Number, prefs->CIACycles, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_FloppyCycles], PrefsWnd, NULL, GTIN_Number, prefs->FloppyCycles, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_SkipFrames], PrefsWnd, NULL, GTIN_Number, prefs->SkipFrames, TAG_DONE);
|
||||
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_SIDType], PrefsWnd, NULL, GTCY_Active, prefs->SIDType, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_REUSize], PrefsWnd, NULL, GTCY_Active, prefs->REUSize, TAG_DONE);
|
||||
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_SpritesOn], PrefsWnd, NULL, GTCB_Checked, prefs->SpritesOn, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_SpriteCollisions], PrefsWnd, NULL, GTCB_Checked, prefs->SpriteCollisions, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_Joystick2On], PrefsWnd, NULL, GTCB_Checked, prefs->Joystick2On, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_JoystickSwap], PrefsWnd, NULL, GTCB_Checked, prefs->JoystickSwap, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_LimitSpeed], PrefsWnd, NULL, GTCB_Checked, prefs->LimitSpeed, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_FastReset], PrefsWnd, NULL, GTCB_Checked, prefs->FastReset, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_CIAIRQHack], PrefsWnd, NULL, GTCB_Checked, prefs->CIAIRQHack, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_SIDFilters], PrefsWnd, NULL, GTCB_Checked, prefs->SIDFilters, TAG_DONE);
|
||||
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_DrivePath8], PrefsWnd, NULL, GTST_String, (ULONG)prefs->DrivePath[0], TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_DrivePath9], PrefsWnd, NULL, GTST_String, (ULONG)prefs->DrivePath[1], TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_DrivePath10], PrefsWnd, NULL, GTST_String, (ULONG)prefs->DrivePath[2], TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_DrivePath11], PrefsWnd, NULL, GTST_String, (ULONG)prefs->DrivePath[3], TAG_DONE);
|
||||
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_MapSlash], PrefsWnd, NULL, GTCB_Checked, prefs->MapSlash, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_Emul1541Proc], PrefsWnd, NULL, GTCB_Checked, prefs->Emul1541Proc, TAG_DONE);
|
||||
|
||||
ghost_gadgets();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the values of the gadgets
|
||||
*/
|
||||
|
||||
static void get_values(void)
|
||||
{
|
||||
prefs->NormalCycles = GetNumber(PrefsGadgets[GDX_NormalCycles]);
|
||||
prefs->BadLineCycles = GetNumber(PrefsGadgets[GDX_BadLineCycles]);
|
||||
prefs->CIACycles = GetNumber(PrefsGadgets[GDX_CIACycles]);
|
||||
prefs->FloppyCycles = GetNumber(PrefsGadgets[GDX_FloppyCycles]);
|
||||
prefs->SkipFrames = GetNumber(PrefsGadgets[GDX_SkipFrames]);
|
||||
|
||||
strcpy(prefs->DrivePath[0], GetString(PrefsGadgets[GDX_DrivePath8]));
|
||||
strcpy(prefs->DrivePath[1], GetString(PrefsGadgets[GDX_DrivePath9]));
|
||||
strcpy(prefs->DrivePath[2], GetString(PrefsGadgets[GDX_DrivePath10]));
|
||||
strcpy(prefs->DrivePath[3], GetString(PrefsGadgets[GDX_DrivePath11]));
|
||||
|
||||
prefs->Check();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enable/disable certain gadgets
|
||||
*/
|
||||
|
||||
static void ghost_gadgets(void)
|
||||
{
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_NormalCycles], PrefsWnd, NULL, GA_Disabled, IsFrodoSC, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_BadLineCycles], PrefsWnd, NULL, GA_Disabled, IsFrodoSC, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_CIACycles], PrefsWnd, NULL, GA_Disabled, IsFrodoSC, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_FloppyCycles], PrefsWnd, NULL, GA_Disabled, IsFrodoSC, TAG_DONE);
|
||||
GT_SetGadgetAttrs(PrefsGadgets[GDX_CIAIRQHack], PrefsWnd, NULL, GA_Disabled, IsFrodoSC, TAG_DONE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle gadgets
|
||||
*/
|
||||
|
||||
int SpritesOnClicked(void)
|
||||
{
|
||||
prefs->SpritesOn = !prefs->SpritesOn;
|
||||
}
|
||||
|
||||
int SpriteCollisionsClicked(void)
|
||||
{
|
||||
prefs->SpriteCollisions = !prefs->SpriteCollisions;
|
||||
}
|
||||
|
||||
int Joystick2OnClicked(void)
|
||||
{
|
||||
prefs->Joystick2On = !prefs->Joystick2On;
|
||||
}
|
||||
|
||||
int JoystickSwapClicked(void)
|
||||
{
|
||||
prefs->JoystickSwap = !prefs->JoystickSwap;
|
||||
}
|
||||
|
||||
int LimitSpeedClicked(void)
|
||||
{
|
||||
prefs->LimitSpeed = !prefs->LimitSpeed;
|
||||
}
|
||||
|
||||
int FastResetClicked(void)
|
||||
{
|
||||
prefs->FastReset = !prefs->FastReset;
|
||||
}
|
||||
|
||||
int CIAIRQHackClicked(void)
|
||||
{
|
||||
prefs->CIAIRQHack = !prefs->CIAIRQHack;
|
||||
}
|
||||
|
||||
int SIDFiltersClicked(void)
|
||||
{
|
||||
prefs->SIDFilters = !prefs->SIDFilters;
|
||||
}
|
||||
|
||||
int NormalCyclesClicked(void) {}
|
||||
int BadLineCyclesClicked(void) {}
|
||||
int CIACyclesClicked(void) {}
|
||||
int FloppyCyclesClicked(void) {}
|
||||
int SkipFramesClicked(void) {}
|
||||
int DrivePath8Clicked(void) {}
|
||||
int DrivePath9Clicked(void) {}
|
||||
int DrivePath10Clicked(void) {}
|
||||
int DrivePath11Clicked(void) {}
|
||||
|
||||
int SIDTypeClicked(void)
|
||||
{
|
||||
prefs->SIDType = PrefsMsg.Code;
|
||||
}
|
||||
|
||||
int REUSizeClicked(void)
|
||||
{
|
||||
prefs->REUSize = PrefsMsg.Code;
|
||||
}
|
||||
|
||||
void get_drive(int i)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (drive_req == NULL)
|
||||
return;
|
||||
|
||||
get_values();
|
||||
|
||||
if (prefs->DriveType[i] == DRVTYPE_DIR)
|
||||
result = AslRequestTags(drive_req,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Select directory",
|
||||
ASLFR_DrawersOnly, TRUE,
|
||||
ASLFR_DoPatterns, FALSE,
|
||||
ASLFR_InitialPattern, (ULONG)"#?",
|
||||
ASLFR_InitialDrawer, (ULONG)prefs->DrivePath[i],
|
||||
ASLFR_InitialFile, (ULONG)"",
|
||||
TAG_DONE);
|
||||
else {
|
||||
|
||||
// Separate path and file
|
||||
char dir[256], file[256];
|
||||
strncpy(dir, prefs->DrivePath[i], 255);
|
||||
char *s = FilePart(dir);
|
||||
strncpy(file, s, 255);
|
||||
*s = 0;
|
||||
|
||||
result = AslRequestTags(drive_req,
|
||||
ASLFR_TitleText, (ULONG)"Frodo: Select disk image or archive file",
|
||||
ASLFR_DrawersOnly, FALSE,
|
||||
ASLFR_DoPatterns, TRUE,
|
||||
ASLFR_InitialPattern, (ULONG)"#?.(d64|x64|t64|LNX|P00)",
|
||||
ASLFR_InitialDrawer, (ULONG)dir,
|
||||
ASLFR_InitialFile, (ULONG)file,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
strncpy(prefs->DrivePath[i], drive_req->fr_Drawer, 255);
|
||||
if (prefs->DriveType[i] != DRVTYPE_DIR)
|
||||
AddPart(prefs->DrivePath[i], drive_req->fr_File, 255);
|
||||
set_values();
|
||||
}
|
||||
}
|
||||
|
||||
int GetDrive8Clicked(void)
|
||||
{
|
||||
get_drive(0);
|
||||
}
|
||||
|
||||
int GetDrive9Clicked(void)
|
||||
{
|
||||
get_drive(1);
|
||||
}
|
||||
|
||||
int GetDrive10Clicked(void)
|
||||
{
|
||||
get_drive(2);
|
||||
}
|
||||
|
||||
int GetDrive11Clicked(void)
|
||||
{
|
||||
get_drive(3);
|
||||
}
|
||||
|
||||
int MapSlashClicked(void)
|
||||
{
|
||||
prefs->MapSlash = !prefs->MapSlash;
|
||||
}
|
||||
|
||||
int Emul1541ProcClicked(void)
|
||||
{
|
||||
prefs->Emul1541Proc = !prefs->Emul1541Proc;
|
||||
}
|
||||
|
||||
int OKClicked(void)
|
||||
{
|
||||
get_values();
|
||||
done = result = TRUE;
|
||||
}
|
||||
|
||||
int CancelClicked(void)
|
||||
{
|
||||
done = TRUE;
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle menus
|
||||
*/
|
||||
|
||||
int PrefsOpen(void)
|
||||
{
|
||||
if (open_req != NULL && AslRequest(open_req, NULL)) {
|
||||
strncpy(path, open_req->fr_Drawer, 255);
|
||||
AddPart(path, open_req->fr_File, 255);
|
||||
|
||||
get_values(); // Useful if Load() is unsuccessful
|
||||
prefs->Load(path);
|
||||
set_values();
|
||||
}
|
||||
}
|
||||
|
||||
int PrefsRevert(void)
|
||||
{
|
||||
get_values(); // Useful if Load() is unsuccessful
|
||||
prefs->Load(path);
|
||||
set_values();
|
||||
}
|
||||
|
||||
int PrefsSaveAs(void)
|
||||
{
|
||||
if (save_req != NULL && AslRequest(save_req, NULL)) {
|
||||
strncpy(path, save_req->fr_Drawer, 255);
|
||||
AddPart(path, save_req->fr_File, 255);
|
||||
|
||||
get_values();
|
||||
prefs->Save(path);
|
||||
}
|
||||
}
|
||||
|
||||
int PrefsSave(void)
|
||||
{
|
||||
get_values();
|
||||
prefs->Save(path);
|
||||
}
|
||||
|
||||
int PrefsOK(void)
|
||||
{
|
||||
return OKClicked();
|
||||
}
|
||||
|
||||
int PrefsCancel(void)
|
||||
{
|
||||
return CancelClicked();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle keys
|
||||
*/
|
||||
|
||||
int PrefsVanillaKey(void)
|
||||
{
|
||||
switch (PrefsMsg.Code) {
|
||||
case 'o': case 'O':
|
||||
return OKClicked();
|
||||
case 'c': case 'C':
|
||||
return CancelClicked();
|
||||
}
|
||||
}
|
779
Src/Prefs_Be.h
779
Src/Prefs_Be.h
@ -1,779 +0,0 @@
|
||||
/*
|
||||
* Prefs_Be.h - Global preferences, Be specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <InterfaceKit.h>
|
||||
#include <StorageKit.h>
|
||||
#include <Path.h>
|
||||
|
||||
|
||||
// Special colors
|
||||
const rgb_color light_color = {255, 255, 255, 0};
|
||||
const rgb_color fill_color = {216, 216, 216, 0};
|
||||
const rgb_color dark_color = {184, 184, 184, 0};
|
||||
|
||||
|
||||
// Window thread messages
|
||||
const uint32 MSG_OK = 'okok';
|
||||
const uint32 MSG_CANCEL = 'cncl';
|
||||
const uint32 MSG_SPRITES_ON = 'spon';
|
||||
const uint32 MSG_SPRITE_COLLISIONS = 'scol';
|
||||
const uint32 MSG_JOYSTICK_1_PORT = 'joy1';
|
||||
const uint32 MSG_JOYSTICK_2_PORT = 'joy2';
|
||||
const uint32 MSG_JOYSTICK_SWAP = 'jswp';
|
||||
const uint32 MSG_LIMIT_SPEED = 'lmit';
|
||||
const uint32 MSG_FAST_RESET = 'frst';
|
||||
const uint32 MSG_CIA_IRQ_HACK = 'cirq';
|
||||
const uint32 MSG_SID_FILTERS = 'filt';
|
||||
const uint32 MSG_DOUBLE_SCAN = 'dbls';
|
||||
const uint32 MSG_MAP_SLASH = 'mpsl';
|
||||
const uint32 MSG_EMUL_1541_PROC = '15pr';
|
||||
const uint32 MSG_GETDRIVE_8 = 'gtd8';
|
||||
const uint32 MSG_GETDRIVE_9 = 'gtd9';
|
||||
const uint32 MSG_GETDRIVE_10 = 'gtd:';
|
||||
const uint32 MSG_GETDRIVE_11 = 'gtd;';
|
||||
const uint32 MSG_DRIVE_PANEL_RETURNED = 'gdr8';
|
||||
const uint32 MSG_SID_TYPE = 'sidt';
|
||||
const uint32 MSG_REU_SIZE = 'reus';
|
||||
const uint32 MSG_DISPLAY_TYPE = 'dspt';
|
||||
|
||||
const uint32 MSG_OPEN = 'open';
|
||||
const uint32 MSG_SAVE = 'save';
|
||||
const uint32 MSG_SAVE_AS = 'svas';
|
||||
const uint32 MSG_REVERT = 'rvrt';
|
||||
const uint32 MSG_OPEN_PANEL_RETURNED = 'oprt';
|
||||
const uint32 MSG_SAVE_PANEL_RETURNED = 'svrt';
|
||||
|
||||
|
||||
/*
|
||||
* Preferences window class
|
||||
*/
|
||||
|
||||
class NumberControl;
|
||||
class PathControl;
|
||||
|
||||
class PrefsWindow : public BWindow {
|
||||
public:
|
||||
PrefsWindow(Prefs *p, bool start, char *path);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual bool QuitRequested(void);
|
||||
virtual bool FilterKeyDown(uint32 *aChar, BView **target);
|
||||
|
||||
private:
|
||||
BCheckBox *make_checkbox(BRect frame, char *label, uint32 what, BView *parent);
|
||||
NumberControl *make_number_entry(BRect frame, char *label_text, BView *parent);
|
||||
PathControl *make_path_entry(BRect frame, char *label, BView *parent);
|
||||
BPopUpMenu *make_sidtype_popup(BRect frame, char *label_text, uint32 what, BView *parent);
|
||||
BPopUpMenu *make_reusize_popup(BRect frame, char *label_text, uint32 what, BView *parent);
|
||||
BPopUpMenu *make_disptype_popup(BRect frame, char *label_text, uint32 what, BView *parent);
|
||||
BPopUpMenu *make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent);
|
||||
void set_values(void);
|
||||
void get_values(void);
|
||||
void ghost_controls(void);
|
||||
|
||||
Prefs *prefs;
|
||||
|
||||
BMessenger this_messenger;
|
||||
BFilePanel *open_panel; // For opening prefs
|
||||
BFilePanel *save_panel; // For saving prefs
|
||||
BFilePanel *file_panel; // For D64/T64 drives
|
||||
BFilePanel *dir_panel; // For directory drives
|
||||
int panel_drive_num; // Drive number (0..3) of the file panel
|
||||
|
||||
BButton *g_ok;
|
||||
BButton *g_cancel;
|
||||
NumberControl *g_normal_cycles;
|
||||
NumberControl *g_bad_line_cycles;
|
||||
NumberControl *g_cia_cycles;
|
||||
NumberControl *g_floppy_cycles;
|
||||
NumberControl *g_skip_frames;
|
||||
PathControl *g_drive_path[4];
|
||||
BPopUpMenu *g_sid_type;
|
||||
BPopUpMenu *g_reu_size;
|
||||
BPopUpMenu *g_display_type;
|
||||
BPopUpMenu *g_joystick_1_port;
|
||||
BPopUpMenu *g_joystick_2_port;
|
||||
BCheckBox *g_sprites_on;
|
||||
BCheckBox *g_sprite_collisions;
|
||||
BCheckBox *g_joystick_swap;
|
||||
BCheckBox *g_limit_speed;
|
||||
BCheckBox *g_fast_reset;
|
||||
BCheckBox *g_cia_irq_hack;
|
||||
BCheckBox *g_sid_filters;
|
||||
BCheckBox *g_double_scan;
|
||||
BCheckBox *g_map_slash;
|
||||
BCheckBox *g_emul_1541_proc;
|
||||
|
||||
char *prefs_path;
|
||||
bool startup;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Start preferences editor (asynchronously)
|
||||
* startup = false: Send MSG_PREFS_DONE to application on close
|
||||
* startup = true : Send MSG_STARTUP to application on close if not canceled,
|
||||
* B_QUIT_REQUESTED otherwise
|
||||
* prefs_name points to the file name of the preferences (which may be changed)
|
||||
*/
|
||||
|
||||
bool Prefs::ShowEditor(bool startup, char *prefs_name)
|
||||
{
|
||||
PrefsWindow *win = new PrefsWindow(this, startup, prefs_name);
|
||||
win->Show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Number-only BTextControl
|
||||
*/
|
||||
|
||||
// Class definition
|
||||
class NumberControl : public BTextControl {
|
||||
public:
|
||||
NumberControl(BRect frame, float divider, const char *name, const char *label, const char *text, BMessage *message);
|
||||
void SetValue(long value);
|
||||
long Value(void);
|
||||
};
|
||||
|
||||
// Constructor: Allow only digits
|
||||
NumberControl::NumberControl(BRect frame, float divider, const char *name, const char *label, const char *text, BMessage *message)
|
||||
: BTextControl(frame, name, label, text, message, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE)
|
||||
{
|
||||
SetDivider(divider);
|
||||
for (int c=0; c<256; c++)
|
||||
if (!isdigit(c) && c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW)
|
||||
((BTextView *)ChildAt(0))->DisallowChar(c);
|
||||
}
|
||||
|
||||
// Set integer value
|
||||
void NumberControl::SetValue(long value)
|
||||
{
|
||||
char str[32];
|
||||
sprintf(str, "%ld", value);
|
||||
SetText(str);
|
||||
}
|
||||
|
||||
// Get integer value
|
||||
long NumberControl::Value(void)
|
||||
{
|
||||
return atol(Text());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Path-entry BTextControl
|
||||
*/
|
||||
|
||||
// Class definition
|
||||
class PathControl : public BTextControl {
|
||||
public:
|
||||
PathControl(BRect frame, float divider, const char *name, const char *label, const char *text, BMessage *message);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
};
|
||||
|
||||
// Constructor: Disable some keys
|
||||
PathControl::PathControl(BRect frame, float divider, const char *name, const char *label, const char *text, BMessage *message)
|
||||
: BTextControl(frame, name, label, text, message, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE)
|
||||
{
|
||||
SetDivider(divider);
|
||||
for (int c=0; c<' '; c++)
|
||||
if (c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW)
|
||||
((BTextView *)ChildAt(0))->DisallowChar(c);
|
||||
}
|
||||
|
||||
// Message received: Look out for dropped refs
|
||||
void PathControl::MessageReceived(BMessage *msg)
|
||||
{
|
||||
if (msg->what == B_SIMPLE_DATA) {
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
|
||||
// First look for refs
|
||||
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR) {
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR) {
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
SetText(the_path.Path());
|
||||
}
|
||||
} else
|
||||
BTextControl::MessageReceived(msg);
|
||||
|
||||
MakeFocus();
|
||||
} else
|
||||
BTextControl::MessageReceived(msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open preferences window
|
||||
*/
|
||||
|
||||
PrefsWindow::PrefsWindow(Prefs *p, bool start, char *path) : BWindow(BRect(0, 0, 400, 349), "Frodo Preferences", B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE), this_messenger(this)
|
||||
{
|
||||
int i;
|
||||
prefs = p;
|
||||
startup = start;
|
||||
prefs_path = path;
|
||||
|
||||
// Move window to right position
|
||||
Lock();
|
||||
MoveTo(80, 80);
|
||||
|
||||
// Set up menus
|
||||
BMenuBar *bar = new BMenuBar(Bounds(), "");
|
||||
BMenu *menu = new BMenu("Preferences");
|
||||
BMenuItem *item;
|
||||
menu->AddItem(item = new BMenuItem("About Frodo" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED)));
|
||||
item->SetTarget(be_app);
|
||||
menu->AddItem(new BSeparatorItem);
|
||||
menu->AddItem(new BMenuItem("Open" B_UTF8_ELLIPSIS, new BMessage(MSG_OPEN), 'O'));
|
||||
menu->AddItem(new BMenuItem("Save", new BMessage(MSG_SAVE), 'S'));
|
||||
menu->AddItem(new BMenuItem("Save As" B_UTF8_ELLIPSIS, new BMessage(MSG_SAVE_AS), 'A'));
|
||||
menu->AddItem(new BMenuItem("Revert", new BMessage(MSG_REVERT)));
|
||||
menu->AddItem(new BSeparatorItem);
|
||||
menu->AddItem(item = new BMenuItem("Quit Frodo", new BMessage(B_QUIT_REQUESTED), 'Q'));
|
||||
item->SetTarget(be_app);
|
||||
bar->AddItem(menu);
|
||||
AddChild(bar);
|
||||
SetKeyMenuBar(bar);
|
||||
int mbar_height = int(bar->Frame().bottom) + 1;
|
||||
|
||||
// Resize window to fit menu bar
|
||||
ResizeBy(0, mbar_height);
|
||||
|
||||
// Light gray background
|
||||
BRect b = Bounds();
|
||||
BView *top = new BView(BRect(0, mbar_height, b.right, b.bottom), "top", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(top);
|
||||
top->SetViewColor(fill_color);
|
||||
|
||||
// Checkboxes
|
||||
g_sprites_on = make_checkbox(BRect(10, 10, 180, 21), "Sprite display", MSG_SPRITES_ON, top);
|
||||
g_sprite_collisions = make_checkbox(BRect(10, 25, 180, 36), "Sprite collisions", MSG_SPRITE_COLLISIONS, top);
|
||||
g_limit_speed = make_checkbox(BRect(10, 40, 180, 51), "Limit speed", MSG_LIMIT_SPEED, top);
|
||||
g_fast_reset = make_checkbox(BRect(10, 55, 180, 66), "Fast reset", MSG_FAST_RESET, top);
|
||||
g_cia_irq_hack = make_checkbox(BRect(10, 70, 180, 81), "Clear CIA ICR on write", MSG_CIA_IRQ_HACK, top);
|
||||
g_sid_filters = make_checkbox(BRect(10, 85, 180, 96), "SID filters", MSG_SID_FILTERS, top);
|
||||
g_double_scan = make_checkbox(BRect(10, 100, 180, 111), "Doublescan lines", MSG_DOUBLE_SCAN, top);
|
||||
g_joystick_swap = make_checkbox(BRect(10, 115, 180, 126), "Swap joysticks", MSG_JOYSTICK_SWAP, top);
|
||||
g_joystick_1_port = make_joystick_popup(BRect(10, 130, 180, 145), "Joystick 1", MSG_JOYSTICK_1_PORT, top);
|
||||
g_joystick_2_port = make_joystick_popup(BRect(10, 150, 180, 165), "Joystick 2", MSG_JOYSTICK_2_PORT, top);
|
||||
|
||||
// Number entry fields
|
||||
g_normal_cycles = make_number_entry(BRect(180, 10, 390, 26), "Cycles per line (CPU)", top);
|
||||
g_bad_line_cycles = make_number_entry(BRect(180, 30, 390, 46), "Cycles per Bad Line (CPU)", top);
|
||||
g_cia_cycles = make_number_entry(BRect(180, 50, 390, 66), "Cycles per line (CIA)", top);
|
||||
g_floppy_cycles = make_number_entry(BRect(180, 70, 390, 86), "Cycles per line (1541)", top);
|
||||
g_skip_frames = make_number_entry(BRect(180, 90, 390, 106), "Draw every n-th frame", top);
|
||||
|
||||
// Popup fields
|
||||
g_display_type = make_disptype_popup(BRect(180, 110, 390, 126), "Display type", MSG_DISPLAY_TYPE, top);
|
||||
g_sid_type = make_sidtype_popup(BRect(180, 130, 390, 146), "SID emulation type", MSG_SID_TYPE, top);
|
||||
g_reu_size = make_reusize_popup(BRect(180, 150, 390, 166), "REU size", MSG_REU_SIZE, top);
|
||||
|
||||
// Prepare on/off pictures for file panel buttons
|
||||
BView *view = new BView(BRect(0, 0, 19, 15), "", B_FOLLOW_NONE, 0);
|
||||
AddChild(view);
|
||||
view->SetViewColor(fill_color);
|
||||
|
||||
view->BeginPicture(new BPicture);
|
||||
view->SetHighColor(fill_color);
|
||||
view->FillRect(BRect(0, 0, 19, 15));
|
||||
view->SetHighColor(light_color);
|
||||
view->StrokeRect(BRect(0, 0, 18, 0));
|
||||
view->StrokeRect(BRect(0, 0, 0, 14));
|
||||
view->SetHighColor(dark_color);
|
||||
view->StrokeRect(BRect(0, 15, 19, 15));
|
||||
view->StrokeRect(BRect(19, 0, 19, 15));
|
||||
view->SetFont(be_plain_font);
|
||||
view->SetHighColor(0, 0, 0);
|
||||
view->SetLowColor(fill_color);
|
||||
view->MovePenTo(7, 11);
|
||||
view->DrawString("B");
|
||||
BPicture *on = view->EndPicture();
|
||||
|
||||
view->BeginPicture(new BPicture);
|
||||
view->SetHighColor(dark_color);
|
||||
view->FillRect(BRect(0, 0, 19, 15));
|
||||
view->SetHighColor(128, 128, 128);
|
||||
view->StrokeRect(BRect(0, 0, 18, 0));
|
||||
view->StrokeRect(BRect(0, 0, 0, 14));
|
||||
view->SetHighColor(light_color);
|
||||
view->StrokeRect(BRect(0, 15, 19, 15));
|
||||
view->StrokeRect(BRect(19, 0, 19, 15));
|
||||
view->SetFont(be_plain_font);
|
||||
view->SetHighColor(0, 0, 0);
|
||||
view->SetLowColor(dark_color);
|
||||
view->MovePenTo(7, 11);
|
||||
view->DrawString("B");
|
||||
BPicture *off = view->EndPicture();
|
||||
|
||||
RemoveChild(view);
|
||||
delete view;
|
||||
|
||||
// Drive settings
|
||||
BBox *drvbox = new BBox(BRect(10, 173, 390, 304));
|
||||
top->AddChild(drvbox);
|
||||
drvbox->SetViewColor(fill_color);
|
||||
drvbox->SetLowColor(fill_color);
|
||||
drvbox->SetLabel("Drives");
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
char str[4];
|
||||
sprintf(str, "%d", i+8);
|
||||
g_drive_path[i] = make_path_entry(BRect(10, 14+i*20, 299, 30+i*20), str, drvbox);
|
||||
drvbox->AddChild(new BPictureButton(BRect(304, 16+i*20, 323, 31+i*20), "", new BPicture(*on), new BPicture(*off), new BMessage(MSG_GETDRIVE_8 + i)));
|
||||
}
|
||||
|
||||
g_map_slash = make_checkbox(BRect(10, 94, 300, 110), "Map '/'<->'\\' in filenames", MSG_MAP_SLASH, drvbox);
|
||||
g_emul_1541_proc = make_checkbox(BRect(10, 109, 300, 125), "Enable 1541 processor emulation", MSG_EMUL_1541_PROC, drvbox);
|
||||
|
||||
// "OK" button
|
||||
top->AddChild(g_ok = new BButton(BRect(20, 315, 90, 340), "", startup ? "Start" : "OK", new BMessage(MSG_OK)));
|
||||
SetDefaultButton(g_ok);
|
||||
|
||||
// "Cancel" button
|
||||
top->AddChild(g_cancel = new BButton(BRect(b.right-90, 315, b.right-20, 340), "", startup ? "Quit" : "Cancel", new BMessage(MSG_CANCEL)));
|
||||
|
||||
// Set the values of all controls to reflect the preferences
|
||||
set_values();
|
||||
g_normal_cycles->MakeFocus();
|
||||
|
||||
// Create file panels
|
||||
open_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_OPEN_PANEL_RETURNED));
|
||||
open_panel->Window()->SetTitle("Frodo: Open preferences");
|
||||
save_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_SAVE_PANEL_RETURNED));
|
||||
save_panel->Window()->SetTitle("Frodo: Save preferences");
|
||||
file_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_DRIVE_PANEL_RETURNED));
|
||||
file_panel->SetPanelDirectory(&AppDirectory);
|
||||
file_panel->Window()->SetTitle("Frodo: Select disk image or archive file");
|
||||
dir_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_DIRECTORY_NODE, false, new BMessage(MSG_DRIVE_PANEL_RETURNED));
|
||||
dir_panel->SetPanelDirectory(&AppDirectory);
|
||||
dir_panel->Window()->SetTitle("Frodo: Select directory");
|
||||
dir_panel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create checkbox
|
||||
*/
|
||||
|
||||
BCheckBox *PrefsWindow::make_checkbox(BRect frame, char *label, uint32 what, BView *parent)
|
||||
{
|
||||
BCheckBox *checkbox = new BCheckBox(frame, "", label, new BMessage(what));
|
||||
parent->AddChild(checkbox);
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create number entry field
|
||||
*/
|
||||
|
||||
NumberControl *PrefsWindow::make_number_entry(BRect frame, char *label_text, BView *parent)
|
||||
{
|
||||
NumberControl *num = new NumberControl(frame, frame.right-frame.left-55, "", label_text, NULL, NULL);
|
||||
parent->AddChild(num);
|
||||
|
||||
num->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_RIGHT);
|
||||
num->SetFont(be_plain_font);
|
||||
num->ChildAt(0)->SetFont(be_plain_font);
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create path entry field
|
||||
*/
|
||||
|
||||
PathControl *PrefsWindow::make_path_entry(BRect frame, char *label, BView *parent)
|
||||
{
|
||||
PathControl *path = new PathControl(frame, 16, "", label, NULL, NULL);
|
||||
parent->AddChild(path);
|
||||
|
||||
path->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||
path->SetFont(be_plain_font);
|
||||
path->ChildAt(0)->SetFont(be_plain_font);
|
||||
((BTextView *)(path->ChildAt(0)))->SetMaxBytes(255);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create display type popup
|
||||
*/
|
||||
|
||||
BPopUpMenu *PrefsWindow::make_disptype_popup(BRect frame, char *label_text, uint32 what, BView *parent)
|
||||
{
|
||||
BPopUpMenu *popup = new BPopUpMenu("display_type popup", true, true);
|
||||
popup->AddItem(new BMenuItem("Window", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("Screen", new BMessage(what)));
|
||||
popup->SetTargetForItems(this);
|
||||
BMenuField *menu_field = new BMenuField(frame, "display_type", label_text, popup);
|
||||
menu_field->SetDivider(frame.Width()-75);
|
||||
menu_field->SetAlignment(B_ALIGN_RIGHT);
|
||||
parent->AddChild(menu_field);
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create SID type popup
|
||||
*/
|
||||
|
||||
BPopUpMenu *PrefsWindow::make_sidtype_popup(BRect frame, char *label_text, uint32 what, BView *parent)
|
||||
{
|
||||
BPopUpMenu *popup = new BPopUpMenu("sid_type popup", true, true);
|
||||
popup->AddItem(new BMenuItem("None", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("Digital", new BMessage(what)));
|
||||
popup->SetTargetForItems(this);
|
||||
BMenuField *menu_field = new BMenuField(frame, "sid_type", label_text, popup);
|
||||
menu_field->SetDivider(frame.Width()-75);
|
||||
menu_field->SetAlignment(B_ALIGN_RIGHT);
|
||||
parent->AddChild(menu_field);
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create REU size popup
|
||||
*/
|
||||
|
||||
BPopUpMenu *PrefsWindow::make_reusize_popup(BRect frame, char *label_text, uint32 what, BView *parent)
|
||||
{
|
||||
BPopUpMenu *popup = new BPopUpMenu("reu_size popup", true, true);
|
||||
popup->AddItem(new BMenuItem("None", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("128K", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("256K", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("512K", new BMessage(what)));
|
||||
popup->SetTargetForItems(this);
|
||||
BMenuField *menu_field = new BMenuField(frame, "reu_size", label_text, popup);
|
||||
menu_field->SetDivider(frame.Width()-75);
|
||||
menu_field->SetAlignment(B_ALIGN_RIGHT);
|
||||
parent->AddChild(menu_field);
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create joystick port popup
|
||||
*/
|
||||
|
||||
BPopUpMenu *PrefsWindow::make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent)
|
||||
{
|
||||
BPopUpMenu *popup = new BPopUpMenu("joystick popup", true, true);
|
||||
popup->AddItem(new BMenuItem("None", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("Joystick Port 1", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("Joystick Port 2", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("GeekPort A", new BMessage(what)));
|
||||
popup->AddItem(new BMenuItem("GeekPort B", new BMessage(what)));
|
||||
popup->SetTargetForItems(this);
|
||||
BMenuField *menu_field = new BMenuField(frame, "joystick", label_text, popup);
|
||||
menu_field->SetDivider(60);
|
||||
menu_field->SetAlignment(B_ALIGN_RIGHT);
|
||||
parent->AddChild(menu_field);
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the values of the controls
|
||||
*/
|
||||
|
||||
void PrefsWindow::set_values(void)
|
||||
{
|
||||
prefs->Check();
|
||||
|
||||
g_normal_cycles->SetValue(prefs->NormalCycles);
|
||||
g_bad_line_cycles->SetValue(prefs->BadLineCycles);
|
||||
g_cia_cycles->SetValue(prefs->CIACycles);
|
||||
g_floppy_cycles->SetValue(prefs->FloppyCycles);
|
||||
g_skip_frames->SetValue(prefs->SkipFrames);
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
g_drive_path[i]->SetText(prefs->DrivePath[i]);
|
||||
|
||||
g_sid_type->ItemAt(prefs->SIDType)->SetMarked(true);
|
||||
g_reu_size->ItemAt(prefs->REUSize)->SetMarked(true);
|
||||
g_display_type->ItemAt(prefs->DisplayType)->SetMarked(true);
|
||||
|
||||
g_sprites_on->SetValue(prefs->SpritesOn ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_sprite_collisions->SetValue(prefs->SpriteCollisions ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_joystick_1_port->ItemAt(prefs->Joystick1Port)->SetMarked(true);
|
||||
g_joystick_2_port->ItemAt(prefs->Joystick2Port)->SetMarked(true);
|
||||
g_joystick_swap->SetValue(prefs->JoystickSwap ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_limit_speed->SetValue(prefs->LimitSpeed ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_fast_reset->SetValue(prefs->FastReset ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_cia_irq_hack->SetValue(prefs->CIAIRQHack ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_sid_filters->SetValue(prefs->SIDFilters ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_double_scan->SetValue(prefs->DoubleScan ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
|
||||
g_map_slash->SetValue(prefs->MapSlash ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
g_emul_1541_proc->SetValue(prefs->Emul1541Proc ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
|
||||
ghost_controls();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the values of the controls
|
||||
*/
|
||||
|
||||
void PrefsWindow::get_values(void)
|
||||
{
|
||||
prefs->NormalCycles = g_normal_cycles->Value();
|
||||
prefs->BadLineCycles = g_bad_line_cycles->Value();
|
||||
prefs->CIACycles = g_cia_cycles->Value();
|
||||
prefs->FloppyCycles = g_floppy_cycles->Value();
|
||||
prefs->SkipFrames = g_skip_frames->Value();
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
strcpy(prefs->DrivePath[i], g_drive_path[i]->Text());
|
||||
|
||||
prefs->Check();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enable/disable certain controls
|
||||
*/
|
||||
|
||||
void PrefsWindow::ghost_controls(void)
|
||||
{
|
||||
g_normal_cycles->SetEnabled(!IsFrodoSC);
|
||||
g_bad_line_cycles->SetEnabled(!IsFrodoSC);
|
||||
g_cia_cycles->SetEnabled(!IsFrodoSC);
|
||||
g_floppy_cycles->SetEnabled(!IsFrodoSC);
|
||||
g_cia_irq_hack->SetEnabled(!IsFrodoSC);
|
||||
g_double_scan->SetEnabled(prefs->DisplayType == DISPTYPE_SCREEN);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Message from controls/menus received
|
||||
*/
|
||||
|
||||
void PrefsWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch (msg->what) {
|
||||
case MSG_OK:
|
||||
get_values();
|
||||
if (startup)
|
||||
be_app->PostMessage(MSG_STARTUP);
|
||||
else {
|
||||
BMessage msg(MSG_PREFS_DONE);
|
||||
msg.AddBool("canceled", false);
|
||||
msg.AddPointer("prefs", prefs);
|
||||
be_app->PostMessage(&msg);
|
||||
}
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
break;
|
||||
|
||||
case MSG_CANCEL:
|
||||
if (startup)
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
else {
|
||||
BMessage msg(MSG_PREFS_DONE);
|
||||
msg.AddBool("canceled", true);
|
||||
msg.AddPointer("prefs", prefs);
|
||||
be_app->PostMessage(&msg);
|
||||
}
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
break;
|
||||
|
||||
case MSG_SPRITES_ON:
|
||||
prefs->SpritesOn = !prefs->SpritesOn;
|
||||
break;
|
||||
|
||||
case MSG_SPRITE_COLLISIONS:
|
||||
prefs->SpriteCollisions = !prefs->SpriteCollisions;
|
||||
break;
|
||||
|
||||
case MSG_JOYSTICK_1_PORT:
|
||||
prefs->Joystick1Port = msg->FindInt32("index");
|
||||
break;
|
||||
|
||||
case MSG_JOYSTICK_2_PORT:
|
||||
prefs->Joystick2Port = msg->FindInt32("index");
|
||||
break;
|
||||
|
||||
case MSG_JOYSTICK_SWAP:
|
||||
prefs->JoystickSwap = !prefs->JoystickSwap;
|
||||
break;
|
||||
|
||||
case MSG_LIMIT_SPEED:
|
||||
prefs->LimitSpeed = !prefs->LimitSpeed;
|
||||
break;
|
||||
|
||||
case MSG_FAST_RESET:
|
||||
prefs->FastReset = !prefs->FastReset;
|
||||
break;
|
||||
|
||||
case MSG_CIA_IRQ_HACK:
|
||||
prefs->CIAIRQHack = !prefs->CIAIRQHack;
|
||||
break;
|
||||
|
||||
case MSG_SID_FILTERS:
|
||||
prefs->SIDFilters = !prefs->SIDFilters;
|
||||
break;
|
||||
|
||||
case MSG_DOUBLE_SCAN:
|
||||
prefs->DoubleScan = !prefs->DoubleScan;
|
||||
break;
|
||||
|
||||
case MSG_SID_TYPE:
|
||||
prefs->SIDType = msg->FindInt32("index");
|
||||
break;
|
||||
|
||||
case MSG_REU_SIZE:
|
||||
prefs->REUSize = msg->FindInt32("index");
|
||||
break;
|
||||
|
||||
case MSG_DISPLAY_TYPE:
|
||||
prefs->DisplayType = msg->FindInt32("index");
|
||||
g_double_scan->SetEnabled(prefs->DisplayType == DISPTYPE_SCREEN);
|
||||
break;
|
||||
|
||||
case MSG_MAP_SLASH:
|
||||
prefs->MapSlash = !prefs->MapSlash;
|
||||
break;
|
||||
|
||||
case MSG_EMUL_1541_PROC:
|
||||
prefs->Emul1541Proc = !prefs->Emul1541Proc;
|
||||
break;
|
||||
|
||||
case MSG_GETDRIVE_8:
|
||||
case MSG_GETDRIVE_9:
|
||||
case MSG_GETDRIVE_10:
|
||||
case MSG_GETDRIVE_11:
|
||||
panel_drive_num = msg->what & 3;
|
||||
// file_panel->Hide();
|
||||
// dir_panel->Hide();
|
||||
file_panel->Show();
|
||||
// dir_panel->Show();
|
||||
break;
|
||||
|
||||
case MSG_DRIVE_PANEL_RETURNED: { // Drive path file panel returned
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR) {
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(prefs->DrivePath[panel_drive_num], the_path.Path(), 255);
|
||||
prefs->DrivePath[panel_drive_num][255] = 0;
|
||||
set_values();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_OPEN:
|
||||
open_panel->Show();
|
||||
break;
|
||||
|
||||
case MSG_OPEN_PANEL_RETURNED: { // Open file panel returned
|
||||
get_values(); // Useful if Load() is unsuccessful
|
||||
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR)
|
||||
if (the_entry.IsFile()) {
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(prefs_path, the_path.Path(), 1023);
|
||||
prefs_path[1023] = 0;
|
||||
prefs->Load(prefs_path);
|
||||
set_values();
|
||||
}
|
||||
}
|
||||
|
||||
case MSG_SAVE:
|
||||
get_values();
|
||||
prefs->Save(prefs_path);
|
||||
break;
|
||||
|
||||
case MSG_SAVE_AS:
|
||||
save_panel->Show();
|
||||
break;
|
||||
|
||||
case MSG_SAVE_PANEL_RETURNED: { // Save file panel returned
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
if (msg->FindRef("directory", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR) {
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(prefs_path, the_path.Path(), 1023);
|
||||
strncat(prefs_path, "/", 1023);
|
||||
strncat(prefs_path, msg->FindString("name"), 1023);
|
||||
prefs_path[1023] = 0;
|
||||
get_values();
|
||||
if (!prefs->Save(prefs_path))
|
||||
ShowRequester("Couldn't save preferences.", "Too bad");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_REVERT:
|
||||
get_values(); // Useful if Load() is unsuccessful
|
||||
prefs->Load(prefs_path);
|
||||
set_values();
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Intercept ESC key (works as clicking the Cancel button)
|
||||
*/
|
||||
|
||||
bool PrefsWindow::FilterKeyDown(uint32 *aChar, BView **target)
|
||||
{
|
||||
if (*aChar == B_ESCAPE) {
|
||||
// Flash Cancel button
|
||||
g_cancel->SetValue(B_CONTROL_ON);
|
||||
snooze(100000);
|
||||
PostMessage(MSG_CANCEL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Quit requested
|
||||
*/
|
||||
|
||||
bool PrefsWindow::QuitRequested(void)
|
||||
{
|
||||
delete open_panel;
|
||||
delete save_panel;
|
||||
delete file_panel;
|
||||
delete dir_panel;
|
||||
return true;
|
||||
}
|
@ -1,403 +0,0 @@
|
||||
/*
|
||||
* Prefs_WIN32.h - Global preferences, WIN32 specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <commctrl.h>
|
||||
#include "resource.h"
|
||||
|
||||
Prefs *Prefs::edit_prefs;
|
||||
char *Prefs::edit_prefs_name;
|
||||
HWND Prefs::hDlg;
|
||||
|
||||
#define STANDARD_PAGE 0
|
||||
#define WIN32_PAGE 1
|
||||
|
||||
bool Prefs::ShowEditor(bool /* startup */, char *prefs_name)
|
||||
{
|
||||
edit_prefs = this;
|
||||
edit_prefs_name = prefs_name;
|
||||
|
||||
PROPSHEETPAGE psp[2];
|
||||
|
||||
// Set up standard preferences property page.
|
||||
psp[0].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[0].dwFlags = PSP_HASHELP;
|
||||
psp[0].hInstance = hInstance;
|
||||
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_PREFERENCES_STANDARD);
|
||||
psp[0].pszIcon = NULL;
|
||||
psp[0].pfnDlgProc = StandardDialogProc;
|
||||
psp[0].pszTitle = NULL;
|
||||
psp[0].lParam = 0;
|
||||
psp[0].pfnCallback = NULL;
|
||||
|
||||
// Set up WIN32 preferences property page.
|
||||
psp[1].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[1].dwFlags = PSP_HASHELP;
|
||||
psp[1].hInstance = hInstance;
|
||||
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PREFERENCES_WIN32);
|
||||
psp[1].pszIcon = NULL;
|
||||
psp[1].pfnDlgProc = WIN32DialogProc;
|
||||
psp[1].pszTitle = NULL;
|
||||
psp[1].lParam = 0;
|
||||
psp[1].pfnCallback = NULL;
|
||||
|
||||
// Setup property sheet.
|
||||
PROPSHEETHEADER psh;
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
||||
psh.hwndParent = hwnd;
|
||||
psh.hInstance = hInstance;
|
||||
psh.pszIcon = NULL;
|
||||
psh.pszCaption = "Preferences";
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
psh.pfnCallback = NULL;
|
||||
|
||||
int result = PropertySheet(&psh);
|
||||
|
||||
if (result == -1)
|
||||
return FALSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL CALLBACK Prefs::StandardDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return edit_prefs->DialogProc(STANDARD_PAGE, hDlg, message, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL CALLBACK Prefs::WIN32DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return edit_prefs->DialogProc(WIN32_PAGE, hDlg, message, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL Prefs::DialogProc(int page, HWND hDlg_arg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
hDlg = hDlg_arg;
|
||||
|
||||
switch (message) {
|
||||
|
||||
case WM_INITDIALOG:
|
||||
SetupControls(page);
|
||||
SetValues(page);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
|
||||
case IDC_BROWSE8:
|
||||
BrowseForDevice(IDC_DEVICE8);
|
||||
break;
|
||||
|
||||
case IDC_BROWSE9:
|
||||
BrowseForDevice(IDC_DEVICE9);
|
||||
break;
|
||||
|
||||
case IDC_BROWSE10:
|
||||
BrowseForDevice(IDC_DEVICE10);
|
||||
break;
|
||||
|
||||
case IDC_BROWSE11:
|
||||
BrowseForDevice(IDC_DEVICE11);
|
||||
break;
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
NMHDR *pnmhdr = (NMHDR *) lParam;
|
||||
switch (pnmhdr->code) {
|
||||
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);
|
||||
break;
|
||||
|
||||
case PSN_APPLY:
|
||||
GetValues(page);
|
||||
break;
|
||||
|
||||
case PSN_HELP:
|
||||
PostMessage(hwnd, WM_COMMAND, ID_HELP_SETTINGS, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define SetupSpin(id, upper, lower) SendMessage(GetDlgItem(hDlg, id), UDM_SETRANGE, 0, MAKELONG(upper, lower))
|
||||
#define SetupSpinIncrement(id, increment) (udaccel.nSec = 0, udaccel.nInc = increment, SendMessage(GetDlgItem(hDlg, id), UDM_SETACCEL, 1, (LPARAM) &udaccel))
|
||||
#define SetupComboClear(id) SendMessage(GetDlgItem(hDlg, id), CB_RESETCONTENT, 0, 0)
|
||||
#define SetupComboAdd(id, string) SendMessage(GetDlgItem(hDlg, id), CB_ADDSTRING, 0, (LPARAM) string)
|
||||
|
||||
void Prefs::SetupControls(int page)
|
||||
{
|
||||
UDACCEL udaccel;
|
||||
switch (page) {
|
||||
|
||||
case STANDARD_PAGE:
|
||||
SetupSpin(IDC_NORMAL_SPIN, 200, 1);
|
||||
SetupSpin(IDC_BADLINES_SPIN, 200, 1);
|
||||
SetupSpin(IDC_CIA_SPIN, 200, 1);
|
||||
SetupSpin(IDC_FLOPPY_SPIN, 200, 1);
|
||||
SetupSpin(IDC_DRAWEVERY_SPIN, 10, 1);
|
||||
SetupComboClear(IDC_REUSIZE);
|
||||
SetupComboAdd(IDC_REUSIZE, "None");
|
||||
SetupComboAdd(IDC_REUSIZE, "128k");
|
||||
SetupComboAdd(IDC_REUSIZE, "256k");
|
||||
SetupComboAdd(IDC_REUSIZE, "512k");
|
||||
break;
|
||||
|
||||
case WIN32_PAGE:
|
||||
SetupComboClear(IDC_VIEWPORT);
|
||||
SetupComboAdd(IDC_VIEWPORT, "Default");
|
||||
SetupComboAdd(IDC_VIEWPORT, "320x200");
|
||||
SetupComboAdd(IDC_VIEWPORT, "336x216");
|
||||
SetupComboAdd(IDC_VIEWPORT, "384x272");
|
||||
SetupComboClear(IDC_DISPLAYMODE);
|
||||
SetupComboAdd(IDC_DISPLAYMODE, "Default");
|
||||
{
|
||||
C64Display *TheDisplay = TheApp->TheC64->TheDisplay;
|
||||
int n = TheDisplay->GetNumDisplayModes();
|
||||
const C64Display::DisplayMode *modes =
|
||||
TheDisplay->GetDisplayModes();
|
||||
for (int i = 0; i < n; i++) {
|
||||
char mode[64];
|
||||
sprintf(mode, "%dx%dx%d%s",
|
||||
modes[i].x, modes[i].y, modes[i].depth,
|
||||
modes[i].modex ? " (ModeX)" : "");
|
||||
SetupComboAdd(IDC_DISPLAYMODE, mode);
|
||||
}
|
||||
}
|
||||
SetupSpin(IDC_SCALINGNUMERATOR_SPIN, 16, 1);
|
||||
SetupSpin(IDC_SCALINGDENOMINATOR_SPIN, 4, 1);
|
||||
SetupSpin(IDC_LATENCYMIN_SPIN, 1000, 20);
|
||||
SetupSpinIncrement(IDC_LATENCYMIN_SPIN, 20);
|
||||
SetupSpin(IDC_LATENCYMAX_SPIN, 1000, 20);
|
||||
SetupSpinIncrement(IDC_LATENCYMAX_SPIN, 20);
|
||||
SetupSpin(IDC_LATENCYAVG_SPIN, 1000, 20);
|
||||
SetupSpinIncrement(IDC_LATENCYAVG_SPIN, 20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define SetText(id, val) SetDlgItemText(hDlg, id, val)
|
||||
#define SetInteger(id, val) SetDlgItemInt(hDlg, id, val, FALSE)
|
||||
#define SetCheckBox(id, val) CheckDlgButton(hDlg, id, (val) ? BST_CHECKED : BST_UNCHECKED)
|
||||
#define SetCombo(id, val) SendMessage(GetDlgItem(hDlg, id), CB_SELECTSTRING, 0, (LPARAM) val)
|
||||
|
||||
void Prefs::SetValues(int page)
|
||||
{
|
||||
const char *str;
|
||||
switch (page) {
|
||||
|
||||
case STANDARD_PAGE:
|
||||
SetText(IDC_DEVICE8, DrivePath[0]);
|
||||
SetText(IDC_DEVICE9, DrivePath[1]);
|
||||
SetText(IDC_DEVICE10, DrivePath[2]);
|
||||
SetText(IDC_DEVICE11, DrivePath[3]);
|
||||
|
||||
SetInteger(IDC_NORMAL, NormalCycles);
|
||||
SetInteger(IDC_BADLINES, BadLineCycles);
|
||||
SetInteger(IDC_CIA, CIACycles);
|
||||
SetInteger(IDC_FLOPPY, FloppyCycles);
|
||||
SetInteger(IDC_DRAWEVERY, SkipFrames);
|
||||
switch (REUSize) {
|
||||
case REU_NONE: str = "None"; break;
|
||||
case REU_128K: str = "128k"; break;
|
||||
case REU_256K: str = "256k"; break;
|
||||
case REU_512K: str = "512k"; break;
|
||||
}
|
||||
SetCombo(IDC_REUSIZE, str);
|
||||
|
||||
SetCheckBox(IDC_LIMITSPEED, LimitSpeed);
|
||||
SetCheckBox(IDC_SPRITES, SpritesOn);
|
||||
SetCheckBox(IDC_SPRITECOLLISIONS, SpriteCollisions);
|
||||
SetCheckBox(IDC_JOYSTICK1, Joystick1On);
|
||||
SetCheckBox(IDC_JOYSTICK2, Joystick2On);
|
||||
SetCheckBox(IDC_SWAPJOYSTICKS, JoystickSwap);
|
||||
SetCheckBox(IDC_FASTRESET, FastReset);
|
||||
SetCheckBox(IDC_CIAIRQHACK, CIAIRQHack);
|
||||
SetCheckBox(IDC_MAPSLASH, MapSlash);
|
||||
SetCheckBox(IDC_SIDEMULATION, SIDType == SIDTYPE_DIGITAL);
|
||||
SetCheckBox(IDC_SIDFILTERS, SIDFilters);
|
||||
SetCheckBox(IDC_1541EMULATION, Emul1541Proc);
|
||||
break;
|
||||
|
||||
case WIN32_PAGE:
|
||||
SetCheckBox(IDC_FULLSCREEN, DisplayType == DISPTYPE_SCREEN);
|
||||
SetCheckBox(IDC_SYSTEMMEMORY, SystemMemory);
|
||||
SetCheckBox(IDC_ALWAYSCOPY, AlwaysCopy);
|
||||
SetText(IDC_VIEWPORT, ViewPort);
|
||||
SetText(IDC_DISPLAYMODE, DisplayMode);
|
||||
|
||||
SetCheckBox(IDC_HIDECURSOR, HideCursor);
|
||||
SetCheckBox(IDC_SYSTEMKEYS, SystemKeys);
|
||||
SetInteger(IDC_SCALINGNUMERATOR, ScalingNumerator);
|
||||
SetInteger(IDC_SCALINGDENOMINATOR, ScalingDenominator);
|
||||
|
||||
SetCheckBox(IDC_DIRECTSOUND, DirectSound);
|
||||
SetCheckBox(IDC_EXCLUSIVESOUND, ExclusiveSound);
|
||||
SetInteger(IDC_LATENCYMIN, LatencyMin);
|
||||
SetInteger(IDC_LATENCYMAX, LatencyMax);
|
||||
SetInteger(IDC_LATENCYAVG, LatencyAvg);
|
||||
|
||||
SetCheckBox(IDC_AUTOPAUSE, AutoPause);
|
||||
SetCheckBox(IDC_PREFSATSTARTUP, PrefsAtStartup);
|
||||
SetCheckBox(IDC_SHOWLEDS, ShowLEDs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define GetCheckBox(id, val) (val = IsDlgButtonChecked(hDlg, id) == BST_CHECKED)
|
||||
#define GetInteger(id, val) (val = GetDlgItemInt(hDlg, id, NULL, FALSE))
|
||||
#define GetText(id, val) GetDlgItemText(hDlg, id, val, sizeof(val))
|
||||
|
||||
void Prefs::GetValues(int page)
|
||||
{
|
||||
BOOL temp;
|
||||
char str[256];
|
||||
switch (page) {
|
||||
|
||||
case STANDARD_PAGE:
|
||||
GetText(IDC_DEVICE8, DrivePath[0]);
|
||||
GetText(IDC_DEVICE9, DrivePath[1]);
|
||||
GetText(IDC_DEVICE10, DrivePath[2]);
|
||||
GetText(IDC_DEVICE11, DrivePath[3]);
|
||||
|
||||
GetInteger(IDC_NORMAL, NormalCycles);
|
||||
GetInteger(IDC_BADLINES, BadLineCycles);
|
||||
GetInteger(IDC_CIA, CIACycles);
|
||||
GetInteger(IDC_FLOPPY, FloppyCycles);
|
||||
GetInteger(IDC_DRAWEVERY, SkipFrames);
|
||||
GetText(IDC_REUSIZE, str);
|
||||
if (strcmp(str, "None") == 0)
|
||||
REUSize = REU_NONE;
|
||||
else if (strcmp(str, "128k") == 0)
|
||||
REUSize = REU_128K;
|
||||
else if (strcmp(str, "256k") == 0)
|
||||
REUSize = REU_256K;
|
||||
else if (strcmp(str, "512k") == 0)
|
||||
REUSize = REU_512K;
|
||||
|
||||
GetCheckBox(IDC_LIMITSPEED, LimitSpeed);
|
||||
GetCheckBox(IDC_SPRITES, SpritesOn);
|
||||
GetCheckBox(IDC_SPRITECOLLISIONS, SpriteCollisions);
|
||||
GetCheckBox(IDC_JOYSTICK1, Joystick1On);
|
||||
GetCheckBox(IDC_JOYSTICK2, Joystick2On);
|
||||
GetCheckBox(IDC_SWAPJOYSTICKS, JoystickSwap);
|
||||
GetCheckBox(IDC_FASTRESET, FastReset);
|
||||
GetCheckBox(IDC_CIAIRQHACK, CIAIRQHack);
|
||||
GetCheckBox(IDC_MAPSLASH, MapSlash);
|
||||
GetCheckBox(IDC_SIDEMULATION, temp);
|
||||
SIDType = temp ? SIDTYPE_DIGITAL : SIDTYPE_NONE;
|
||||
GetCheckBox(IDC_SIDFILTERS, SIDFilters);
|
||||
GetCheckBox(IDC_1541EMULATION, Emul1541Proc);
|
||||
break;
|
||||
|
||||
case WIN32_PAGE:
|
||||
GetCheckBox(IDC_FULLSCREEN, temp);
|
||||
DisplayType = temp ? DISPTYPE_SCREEN : DISPTYPE_WINDOW;
|
||||
GetCheckBox(IDC_SYSTEMMEMORY, SystemMemory);
|
||||
GetCheckBox(IDC_ALWAYSCOPY, AlwaysCopy);
|
||||
GetText(IDC_VIEWPORT, ViewPort);
|
||||
GetText(IDC_DISPLAYMODE, DisplayMode);
|
||||
|
||||
GetCheckBox(IDC_HIDECURSOR, HideCursor);
|
||||
GetCheckBox(IDC_SYSTEMKEYS, SystemKeys);
|
||||
GetInteger(IDC_SCALINGNUMERATOR, ScalingNumerator);
|
||||
GetInteger(IDC_SCALINGDENOMINATOR, ScalingDenominator);
|
||||
|
||||
GetCheckBox(IDC_DIRECTSOUND, DirectSound);
|
||||
GetCheckBox(IDC_EXCLUSIVESOUND, ExclusiveSound);
|
||||
GetInteger(IDC_LATENCYMIN, LatencyMin);
|
||||
GetInteger(IDC_LATENCYMAX, LatencyMax);
|
||||
GetInteger(IDC_LATENCYAVG, LatencyAvg);
|
||||
|
||||
GetCheckBox(IDC_AUTOPAUSE, AutoPause);
|
||||
GetCheckBox(IDC_PREFSATSTARTUP, PrefsAtStartup);
|
||||
GetCheckBox(IDC_SHOWLEDS, ShowLEDs);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
DriveType[i] = DRVTYPE_DIR;
|
||||
int length = strlen(DrivePath[i]);
|
||||
if (length >= 4) {
|
||||
char *suffix = DrivePath[i] + length - 4;
|
||||
if (stricmp(suffix, ".t64") == 0)
|
||||
DriveType[i] = DRVTYPE_T64;
|
||||
else if (stricmp(suffix, ".d64") == 0)
|
||||
DriveType[i] = DRVTYPE_D64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Prefs::BrowseForDevice(int id)
|
||||
{
|
||||
char filename[256];
|
||||
GetDlgItemText(hDlg, id, filename, sizeof(filename));
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = hDlg;
|
||||
ofn.hInstance = hInstance;
|
||||
ofn.lpstrFilter =
|
||||
"All Files (*.*)\0*.*\0"
|
||||
"All C64 Files (*.d64;*.t64)\0*.d64;*.t64\0"
|
||||
"D64 Files (*.d64)\0*.d64\0"
|
||||
"T64 Files (*.t64)\0*.t64\0"
|
||||
;
|
||||
ofn.lpstrCustomFilter = NULL;
|
||||
ofn.nMaxCustFilter = 0;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = sizeof(filename);
|
||||
ofn.lpstrFileTitle = NULL;
|
||||
ofn.nMaxFileTitle = 0;
|
||||
ofn.lpstrInitialDir = NULL;
|
||||
ofn.lpstrTitle = "Set Device";
|
||||
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_NOTESTFILECREATE |
|
||||
OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR | OFN_SHAREAWARE;
|
||||
ofn.nFileOffset = 0;
|
||||
ofn.nFileExtension = 0;
|
||||
ofn.lpstrDefExt = NULL;
|
||||
ofn.lpfnHook = NULL;
|
||||
ofn.lpTemplateName = NULL;
|
||||
BOOL result = GetOpenFileName(&ofn);
|
||||
if (result) {
|
||||
const char *ext = filename + ofn.nFileExtension;
|
||||
if (stricmp(ext, "d64") != 0 && stricmp(ext, "t64") != 0)
|
||||
filename[ofn.nFileOffset - 1] = '\0';
|
||||
char cwd[256];
|
||||
GetCurrentDirectory(sizeof(cwd), cwd);
|
||||
int cwd_len = strlen(cwd);
|
||||
if (cwd_len > 0 && cwd[cwd_len - 1] != '\\') {
|
||||
strcat(cwd, "\\");
|
||||
cwd_len++;
|
||||
}
|
||||
if (strnicmp(filename, cwd, cwd_len) == 0)
|
||||
SetDlgItemText(hDlg, id, filename + cwd_len);
|
||||
else
|
||||
SetDlgItemText(hDlg, id, filename);
|
||||
}
|
||||
}
|
107
Src/SID_Acorn.h
107
Src/SID_Acorn.h
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* SID_Acorn.h - 6581 emulation, RISC OS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "C64.h"
|
||||
|
||||
|
||||
void DigitalRenderer::init_sound(void)
|
||||
{
|
||||
_kernel_oserror *err;
|
||||
|
||||
ready = false; sound_buffer = NULL;
|
||||
if ((DigitalRenderer_ReadState() & DRState_Active) != 0)
|
||||
{
|
||||
_kernel_oserror dra;
|
||||
|
||||
dra.errnum = 0; sprintf(dra.errmess,"Can't claim sound system -- already active!");
|
||||
Wimp_ReportError(&dra,1,TASKNAME); return;
|
||||
}
|
||||
// Try starting up the renderer
|
||||
sndbufsize = 2*224; linecnt = 0;
|
||||
if ((err = DigitalRenderer_Activate(1,sndbufsize,1000000/SAMPLE_FREQ)) != NULL)
|
||||
{
|
||||
Wimp_ReportError(err,1,TASKNAME); return;
|
||||
}
|
||||
sound_buffer = new uint8[sndbufsize];
|
||||
ready = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DigitalRenderer::~DigitalRenderer()
|
||||
{
|
||||
if (ready)
|
||||
{
|
||||
_kernel_oserror *err;
|
||||
|
||||
delete sound_buffer;
|
||||
if ((err = DigitalRenderer_Deactivate()) != NULL)
|
||||
{
|
||||
Wimp_ReportError(err,1,TASKNAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DigitalRenderer::EmulateLine(void)
|
||||
{
|
||||
if (ready)
|
||||
{
|
||||
sample_buf[sample_in_ptr++] = volume;
|
||||
// faster than modulo; usually there shouldn't be a loop (while)...
|
||||
while (sample_in_ptr >= SAMPLE_BUF_SIZE) {sample_in_ptr -= SAMPLE_BUF_SIZE;}
|
||||
|
||||
// A similar approach to the HP variant: check every <number> of lines if
|
||||
// new sample needed.
|
||||
if (--linecnt < 0)
|
||||
{
|
||||
int status;
|
||||
|
||||
linecnt = the_c64->PollSoundAfter;
|
||||
if ((status = DigitalRenderer_ReadState()) > 0)
|
||||
{
|
||||
if ((status & DRState_NeedData) != 0)
|
||||
{
|
||||
calc_buffer(sound_buffer, sndbufsize);
|
||||
DigitalRenderer_NewSample(sound_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DigitalRenderer::Pause(void)
|
||||
{
|
||||
if (ready) {DigitalRenderer_Pause();}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DigitalRenderer::Resume(void)
|
||||
{
|
||||
if (ready) {DigitalRenderer_Resume();}
|
||||
}
|
102
Src/SID_Be.h
102
Src/SID_Be.h
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* SID_Be.h - 6581 emulation, Be specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "C64.h"
|
||||
|
||||
|
||||
/*
|
||||
* Initialization, open subscriber
|
||||
*/
|
||||
|
||||
#if B_HOST_IS_LENDIAN
|
||||
const media_raw_audio_format audio_format = {SAMPLE_FREQ, 1, media_raw_audio_format::B_AUDIO_SHORT, B_MEDIA_LITTLE_ENDIAN, SAMPLE_FREQ / CALC_FREQ * 2};
|
||||
#else
|
||||
const media_raw_audio_format audio_format = {SAMPLE_FREQ, 1, media_raw_audio_format::B_AUDIO_SHORT, B_MEDIA_BIG_ENDIAN, SAMPLE_FREQ / CALC_FREQ * 2};
|
||||
#endif
|
||||
|
||||
void DigitalRenderer::init_sound(void)
|
||||
{
|
||||
the_player = new BSoundPlayer(&audio_format, "Frodo", buffer_proc, NULL, this);
|
||||
the_player->SetHasData(true);
|
||||
the_player->Start();
|
||||
player_stopped = false;
|
||||
ready = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destructor, close subscriber
|
||||
*/
|
||||
|
||||
DigitalRenderer::~DigitalRenderer()
|
||||
{
|
||||
if (the_player) {
|
||||
the_player->Stop();
|
||||
delete the_player;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sample volume (for sampled voice)
|
||||
*/
|
||||
|
||||
void DigitalRenderer::EmulateLine(void)
|
||||
{
|
||||
sample_buf[sample_in_ptr] = volume;
|
||||
sample_in_ptr = (sample_in_ptr + 1) % SAMPLE_BUF_SIZE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pause sound output
|
||||
*/
|
||||
|
||||
void DigitalRenderer::Pause(void)
|
||||
{
|
||||
if (!player_stopped) {
|
||||
the_player->Stop();
|
||||
player_stopped = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Resume sound output
|
||||
*/
|
||||
|
||||
void DigitalRenderer::Resume(void)
|
||||
{
|
||||
if (player_stopped) {
|
||||
the_player->Start();
|
||||
player_stopped = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stream function
|
||||
*/
|
||||
|
||||
void DigitalRenderer::buffer_proc(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format)
|
||||
{
|
||||
((DigitalRenderer *)cookie)->calc_buffer((int16 *)buffer, size);
|
||||
((DigitalRenderer *)cookie)->the_c64->SoundSync();
|
||||
}
|
569
Src/SID_WIN32.h
569
Src/SID_WIN32.h
@ -1,569 +0,0 @@
|
||||
/*
|
||||
* SID_WIN32.h - 6581 emulation, WIN32 specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <dsound.h>
|
||||
|
||||
#include "VIC.h"
|
||||
#include "main.h"
|
||||
|
||||
#define FRAG_FREQ SCREEN_FREQ // one frag per frame
|
||||
|
||||
#define FRAGMENT_SIZE (SAMPLE_FREQ/FRAG_FREQ) // samples, not bytes
|
||||
#define FRAG_INTERVAL (1000/FRAG_FREQ) // in milliseconds
|
||||
#define BUFFER_FRAGS FRAG_FREQ // frags the in buffer
|
||||
#define BUFFER_SIZE (2*FRAGMENT_SIZE*BUFFER_FRAGS) // bytes, not samples
|
||||
#define MAX_LEAD_AVG BUFFER_FRAGS // lead average count
|
||||
|
||||
// This won't hurt DirectX 2 but it will help when using the DirectX 3 runtime.
|
||||
#if !defined(DSBCAPS_GETCURRENTPOSITION2)
|
||||
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000
|
||||
#endif
|
||||
|
||||
class DigitalPlayer {
|
||||
|
||||
public:
|
||||
virtual ~DigitalPlayer() = 0;
|
||||
virtual BOOL Ready() = 0;
|
||||
virtual int GetCurrentPosition() = 0;
|
||||
virtual void Write(void *buffer, int position, int length) = 0;
|
||||
virtual void Pause() = 0;
|
||||
virtual void Resume() = 0;
|
||||
};
|
||||
|
||||
DigitalPlayer::~DigitalPlayer()
|
||||
{
|
||||
}
|
||||
|
||||
class DirectSound: public DigitalPlayer {
|
||||
|
||||
public:
|
||||
DirectSound();
|
||||
~DirectSound();
|
||||
BOOL Ready();
|
||||
int GetCurrentPosition();
|
||||
void Write(void *buffer, int position, int length);
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
private:
|
||||
BOOL ready;
|
||||
LPDIRECTSOUND pDS;
|
||||
LPDIRECTSOUNDBUFFER pPrimaryBuffer;
|
||||
LPDIRECTSOUNDBUFFER pSoundBuffer;
|
||||
};
|
||||
|
||||
class WaveOut: public DigitalPlayer {
|
||||
|
||||
public:
|
||||
WaveOut();
|
||||
~WaveOut();
|
||||
BOOL Ready();
|
||||
int GetCurrentPosition();
|
||||
void Write(void *buffer, int position, int length);
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
private:
|
||||
void UnprepareHeader(int index);
|
||||
void UnprepareHeaders();
|
||||
|
||||
private:
|
||||
BOOL ready;
|
||||
HWAVEOUT hWaveOut;
|
||||
char wave_buffer[BUFFER_SIZE];
|
||||
WAVEHDR wave_header[SCREEN_FREQ];
|
||||
int last_unprepared;
|
||||
};
|
||||
|
||||
void DigitalRenderer::init_sound()
|
||||
{
|
||||
ready = FALSE;
|
||||
sound_buffer = new SWORD[2*FRAGMENT_SIZE];
|
||||
ThePlayer = 0;
|
||||
to_output = 0;
|
||||
divisor = 0;
|
||||
lead = new int[MAX_LEAD_AVG];
|
||||
|
||||
StartPlayer();
|
||||
}
|
||||
|
||||
DigitalRenderer::~DigitalRenderer()
|
||||
{
|
||||
StopPlayer();
|
||||
|
||||
delete[] sound_buffer;
|
||||
delete[] lead;
|
||||
}
|
||||
|
||||
void DigitalRenderer::StartPlayer()
|
||||
{
|
||||
direct_sound = ThePrefs.DirectSound;
|
||||
if (ThePrefs.DirectSound)
|
||||
ThePlayer = new DirectSound;
|
||||
else
|
||||
ThePlayer = new WaveOut;
|
||||
ready = ThePlayer->Ready();
|
||||
sb_pos = 0;
|
||||
memset(lead, 0, sizeof(lead));
|
||||
lead_pos = 0;
|
||||
}
|
||||
|
||||
void DigitalRenderer::StopPlayer()
|
||||
{
|
||||
delete ThePlayer;
|
||||
ready = FALSE;
|
||||
}
|
||||
|
||||
void DigitalRenderer::EmulateLine()
|
||||
{
|
||||
if (!ready)
|
||||
return;
|
||||
|
||||
sample_buf[sample_in_ptr] = volume;
|
||||
sample_in_ptr = (sample_in_ptr + 1) % SAMPLE_BUF_SIZE;
|
||||
|
||||
#if 0
|
||||
// Now see how many samples have to be added for this line.
|
||||
// XXX: This is too much computation here, precompute it.
|
||||
divisor += SAMPLE_FREQ;
|
||||
while (divisor >= 0)
|
||||
divisor -= TOTAL_RASTERS*SCREEN_FREQ, to_output++;
|
||||
|
||||
// Calculate the sound data only when we have enough to fill
|
||||
// the buffer entirely.
|
||||
if (to_output < FRAGMENT_SIZE)
|
||||
return;
|
||||
to_output -= FRAGMENT_SIZE;
|
||||
|
||||
VBlank();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DigitalRenderer::VBlank()
|
||||
{
|
||||
if (!ready)
|
||||
return;
|
||||
|
||||
// Delete and recreate the player if preferences have changed.
|
||||
if (direct_sound != ThePrefs.DirectSound) {
|
||||
StopPlayer();
|
||||
StartPlayer();
|
||||
}
|
||||
|
||||
// Convert latency preferences from milliseconds to frags.
|
||||
int lead_smooth = ThePrefs.LatencyAvg/FRAG_INTERVAL;
|
||||
int lead_hiwater = ThePrefs.LatencyMax/FRAG_INTERVAL;
|
||||
int lead_lowater = ThePrefs.LatencyMin/FRAG_INTERVAL;
|
||||
|
||||
// Compute the current lead in frags.
|
||||
int current_position = ThePlayer->GetCurrentPosition();
|
||||
if (current_position == -1)
|
||||
return;
|
||||
int lead_in_bytes = (sb_pos - current_position + BUFFER_SIZE) % BUFFER_SIZE;
|
||||
if (lead_in_bytes >= BUFFER_SIZE/2)
|
||||
lead_in_bytes -= BUFFER_SIZE;
|
||||
int lead_in_frags = lead_in_bytes / int(2*FRAGMENT_SIZE);
|
||||
lead[lead_pos++] = lead_in_frags;
|
||||
if (lead_pos == lead_smooth)
|
||||
lead_pos = 0;
|
||||
|
||||
// Compute the average lead in frags.
|
||||
int avg_lead = 0;
|
||||
for (int i = 0; i < lead_smooth; i++)
|
||||
avg_lead += lead[i];
|
||||
avg_lead /= lead_smooth;
|
||||
//Debug("lead = %d, avg = %d\n", lead_in_frags, avg_lead);
|
||||
|
||||
// If we're getting too far ahead of the audio skip a frag.
|
||||
if (avg_lead > lead_hiwater) {
|
||||
for (int i = 0; i < lead_smooth; i++)
|
||||
lead[i]--;
|
||||
Debug("Skipping a frag...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate one frag.
|
||||
int nsamples = FRAGMENT_SIZE;
|
||||
calc_buffer(sound_buffer, 2*FRAGMENT_SIZE);
|
||||
|
||||
// If we're getting too far behind the audio add an extra frag.
|
||||
if (avg_lead < lead_lowater) {
|
||||
for (int i = 0; i < lead_smooth; i++)
|
||||
lead[i]++;
|
||||
Debug("Adding an extra frag...\n");
|
||||
calc_buffer(sound_buffer + FRAGMENT_SIZE, 2*FRAGMENT_SIZE);
|
||||
nsamples += FRAGMENT_SIZE;
|
||||
}
|
||||
|
||||
// Write the frags to the player and update out write position.
|
||||
ThePlayer->Write(sound_buffer, sb_pos, 2*nsamples);
|
||||
sb_pos = (sb_pos + 2*nsamples) % BUFFER_SIZE;
|
||||
}
|
||||
|
||||
void DigitalRenderer::Pause()
|
||||
{
|
||||
if (!ready)
|
||||
return;
|
||||
ThePlayer->Pause();
|
||||
}
|
||||
|
||||
void DigitalRenderer::Resume()
|
||||
{
|
||||
if (!ready)
|
||||
return;
|
||||
ThePlayer->Resume();
|
||||
}
|
||||
|
||||
// Direct sound implemenation.
|
||||
|
||||
DirectSound::DirectSound()
|
||||
{
|
||||
ready = FALSE;
|
||||
pDS = NULL;
|
||||
pPrimaryBuffer = NULL;
|
||||
pSoundBuffer = NULL;
|
||||
|
||||
HRESULT dsrval = DirectSoundCreate(NULL, &pDS, NULL);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("DirectSoundCreate failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set cooperative level trying to get exclusive or normal mode.
|
||||
DWORD level = ThePrefs.ExclusiveSound ? DSSCL_EXCLUSIVE : DSSCL_NORMAL;
|
||||
dsrval = pDS->SetCooperativeLevel(hwnd, level);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("SetCooperativeLevel failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
WAVEFORMATEX wfx;
|
||||
memset(&wfx, 0, sizeof(wfx));
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = 1;
|
||||
wfx.nSamplesPerSec = 44100;
|
||||
wfx.wBitsPerSample = 16;
|
||||
wfx.nBlockAlign = wfx.nChannels*wfx.wBitsPerSample/8;
|
||||
wfx.nAvgBytesPerSec = wfx.nBlockAlign*wfx.nSamplesPerSec;
|
||||
wfx.cbSize = 0;
|
||||
|
||||
DSBUFFERDESC dsbd;
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
dsbd.dwBufferBytes = 0;
|
||||
dsbd.lpwfxFormat = NULL;
|
||||
|
||||
dsrval = pDS->CreateSoundBuffer(&dsbd, &pPrimaryBuffer, NULL);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("CreateSoundBuffer for primary failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
dsrval = pPrimaryBuffer->SetFormat(&wfx);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("SetFormat on primary failed", dsrval);
|
||||
//return;
|
||||
}
|
||||
|
||||
dsrval = pPrimaryBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("Play primary failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
|
||||
dsbd.dwBufferBytes = BUFFER_SIZE;
|
||||
dsbd.lpwfxFormat = &wfx;
|
||||
|
||||
dsrval = pDS->CreateSoundBuffer(&dsbd, &pSoundBuffer, NULL);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("CreateSoundBuffer failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
ready = TRUE;
|
||||
}
|
||||
|
||||
DirectSound::~DirectSound()
|
||||
{
|
||||
if (pDS != NULL) {
|
||||
if (pSoundBuffer != NULL) {
|
||||
pSoundBuffer->Release();
|
||||
pSoundBuffer = NULL;
|
||||
}
|
||||
if (pPrimaryBuffer != NULL) {
|
||||
pPrimaryBuffer->Release();
|
||||
pPrimaryBuffer = NULL;
|
||||
}
|
||||
pDS->Release();
|
||||
pDS = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL DirectSound::Ready()
|
||||
{
|
||||
return ready;
|
||||
}
|
||||
|
||||
int DirectSound::GetCurrentPosition()
|
||||
{
|
||||
DWORD dwPlayPos, dwWritePos;
|
||||
HRESULT dsrval = pSoundBuffer->GetCurrentPosition(&dwPlayPos, &dwWritePos);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("GetCurrentPostion failed", dsrval);
|
||||
return -1;
|
||||
}
|
||||
return dwWritePos;
|
||||
}
|
||||
|
||||
void DirectSound::Write(void *buffer, int position, int length)
|
||||
{
|
||||
// Lock sound buffer.
|
||||
LPVOID pMem1, pMem2;
|
||||
DWORD dwSize1, dwSize2;
|
||||
HRESULT dsrval = pSoundBuffer->Lock(position, length,
|
||||
&pMem1, &dwSize1, &pMem2, &dwSize2, 0);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("Sound Lock failed", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy the sample buffer into the sound buffer.
|
||||
BYTE *pSample = (BYTE *) buffer;
|
||||
memcpy(pMem1, pSample, dwSize1);
|
||||
if (dwSize2 != 0)
|
||||
memcpy(pMem2, pSample + dwSize1, dwSize2);
|
||||
|
||||
// Unlock the sound buffer.
|
||||
dsrval = pSoundBuffer->Unlock(pMem1, dwSize1, pMem2, dwSize2);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("Unlock failed\n", dsrval);
|
||||
return;
|
||||
}
|
||||
|
||||
// Play the sound buffer.
|
||||
dsrval = pSoundBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
if (dsrval != DS_OK) {
|
||||
DebugResult("Play failed", dsrval);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DirectSound::Pause()
|
||||
{
|
||||
HRESULT dsrval = pSoundBuffer->Stop();
|
||||
if (dsrval != DS_OK)
|
||||
DebugResult("Stop failed", dsrval);
|
||||
dsrval = pPrimaryBuffer->Stop();
|
||||
if (dsrval != DS_OK)
|
||||
DebugResult("Stop primary failed", dsrval);
|
||||
}
|
||||
|
||||
void DirectSound::Resume()
|
||||
{
|
||||
HRESULT dsrval = pPrimaryBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
if (dsrval != DS_OK)
|
||||
DebugResult("Play primary failed", dsrval);
|
||||
dsrval = pSoundBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
if (dsrval != DS_OK)
|
||||
DebugResult("Play failed", dsrval);
|
||||
}
|
||||
|
||||
// Wave output implemenation.
|
||||
|
||||
WaveOut::WaveOut()
|
||||
{
|
||||
ready = FALSE;
|
||||
|
||||
WAVEFORMATEX wfx;
|
||||
memset(&wfx, 0, sizeof(wfx));
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = 1;
|
||||
wfx.nSamplesPerSec = 44100;
|
||||
wfx.wBitsPerSample = 16;
|
||||
wfx.nBlockAlign = wfx.nChannels*wfx.wBitsPerSample/8;
|
||||
wfx.nAvgBytesPerSec = wfx.nBlockAlign*wfx.nSamplesPerSec;
|
||||
wfx.cbSize = 0;
|
||||
MMRESULT worval = waveOutOpen(&hWaveOut, WAVE_MAPPER, &wfx, 0, 0, 0);
|
||||
if (worval != MMSYSERR_NOERROR) {
|
||||
Debug("waveOutOpen returned %d\n", worval);
|
||||
return;
|
||||
}
|
||||
memset(wave_header, 0, sizeof(wave_header));
|
||||
|
||||
last_unprepared = 0;
|
||||
|
||||
ready = TRUE;
|
||||
}
|
||||
|
||||
WaveOut::~WaveOut()
|
||||
{
|
||||
waveOutReset(hWaveOut);
|
||||
UnprepareHeaders();
|
||||
waveOutClose(hWaveOut);
|
||||
}
|
||||
|
||||
BOOL WaveOut::Ready()
|
||||
{
|
||||
return ready;
|
||||
}
|
||||
|
||||
int WaveOut::GetCurrentPosition()
|
||||
{
|
||||
MMTIME mmtime;
|
||||
memset(&mmtime, 0, sizeof(mmtime));
|
||||
mmtime.wType = TIME_BYTES;
|
||||
MMRESULT worval = waveOutGetPosition(hWaveOut, &mmtime, sizeof(mmtime));
|
||||
if (worval != MMSYSERR_NOERROR) {
|
||||
Debug("waveOutGetPosition(%d) returned %d\n", worval);
|
||||
return -1;
|
||||
}
|
||||
int current_position = mmtime.u.cb % BUFFER_SIZE;
|
||||
return current_position;
|
||||
}
|
||||
|
||||
void WaveOut::Write(void *buffer, int position, int length)
|
||||
{
|
||||
// If we are called for a double length buffer split it in half.
|
||||
if (length == 4*FRAGMENT_SIZE) {
|
||||
int half = length/2;
|
||||
Write(buffer, position, half);
|
||||
Write(((char *) buffer) + half, position + half, half);
|
||||
return;
|
||||
}
|
||||
|
||||
// Free up as many previous frags as possible.
|
||||
for (;;) {
|
||||
WAVEHDR &wh = wave_header[last_unprepared];
|
||||
if (!(wh.dwFlags & WHDR_DONE))
|
||||
break;
|
||||
UnprepareHeader(last_unprepared);
|
||||
last_unprepared++;
|
||||
if (last_unprepared == BUFFER_FRAGS)
|
||||
last_unprepared = 0;
|
||||
}
|
||||
|
||||
// Make sure the current header isn't in use.
|
||||
int index = position/(2*FRAGMENT_SIZE);
|
||||
WAVEHDR &wh = wave_header[index];
|
||||
if (wh.dwFlags & WHDR_DONE)
|
||||
UnprepareHeader(index);
|
||||
if (wh.dwFlags != 0) {
|
||||
Debug("wave header %d is in use!\n", index);
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare the header and write the sound data.
|
||||
wh.lpData = wave_buffer + position;
|
||||
wh.dwBufferLength = length;
|
||||
wh.dwFlags = 0;
|
||||
memcpy(wh.lpData, buffer, length);
|
||||
MMRESULT worval = waveOutPrepareHeader(hWaveOut, &wh, sizeof(wh));
|
||||
if (worval != MMSYSERR_NOERROR) {
|
||||
Debug("waveOutPrepareHeader(%d) returned %d\n", index, worval);
|
||||
return;
|
||||
}
|
||||
worval = waveOutWrite(hWaveOut, &wh, sizeof(wh));
|
||||
if (worval != MMSYSERR_NOERROR) {
|
||||
Debug("waveOutWrite(%d) returned %d\n", index, worval);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void WaveOut::Pause()
|
||||
{
|
||||
waveOutPause(hWaveOut);
|
||||
}
|
||||
|
||||
void WaveOut::Resume()
|
||||
{
|
||||
waveOutRestart(hWaveOut);
|
||||
}
|
||||
|
||||
void WaveOut::UnprepareHeader(int index)
|
||||
{
|
||||
WAVEHDR &wh = wave_header[index];
|
||||
MMRESULT worval = waveOutUnprepareHeader(hWaveOut, &wh, sizeof(wh));
|
||||
if (worval != MMSYSERR_NOERROR) {
|
||||
Debug("waveOutUnprepareHeader(%d) returned %d\n", index, worval);
|
||||
return;
|
||||
}
|
||||
memset(&wh, 0, sizeof(wh));
|
||||
}
|
||||
|
||||
void WaveOut::UnprepareHeaders()
|
||||
{
|
||||
for (int i = 0; i < BUFFER_FRAGS; i++) {
|
||||
WAVEHDR &wh = wave_header[i];
|
||||
if (wh.dwFlags & WHDR_DONE)
|
||||
UnprepareHeader(i);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
// Log player implemenation.
|
||||
|
||||
void Log::Write()
|
||||
{
|
||||
// Dump the sound output to the log for debugging.
|
||||
{
|
||||
int last = sound_buffer[0];
|
||||
int count = 1;
|
||||
for (int i = 1; i < nsamples; i++) {
|
||||
if (sound_buffer[i] == last) {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
Debug("[%dx%d] ", count, last);
|
||||
count = 1;
|
||||
last = sound_buffer[i];
|
||||
}
|
||||
Debug("[%dx%d] ", count, last);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
// File player implemenation.
|
||||
|
||||
void Log::Write()
|
||||
{
|
||||
// Log the sound output to a file for debugging.
|
||||
{
|
||||
static FILE *ofp = NULL;
|
||||
if (ofp == NULL) {
|
||||
ofp = fopen("debug.sid", "wb");
|
||||
if (ofp == NULL)
|
||||
Debug("fopen failed\n");
|
||||
}
|
||||
if (ofp != NULL) {
|
||||
Debug("Write sound data to file\n");
|
||||
if (fwrite(sound_buffer, 1, 2*nsamples, ofp) != 2*nsamples)
|
||||
Debug("fwrite failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
191
Src/SID_hp.h
191
Src/SID_hp.h
@ -1,191 +0,0 @@
|
||||
/*
|
||||
* SID_hp.h - 6581 emulation, HP-UX specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include <sys/audio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
}
|
||||
|
||||
#define TXBUFSIZE 16384 // bytes, not samples
|
||||
#define TXFRAGSIZE 1024 // samples, not bytes
|
||||
#define TXLOWWATER (TXBUFSIZE-(TXFRAGSIZE*2)) // bytes, not samples
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
void DigitalRenderer::init_sound(void)
|
||||
{
|
||||
ready = false;
|
||||
|
||||
if ((fd = open("/dev/audio", O_WRONLY | O_NDELAY, 0)) < 0) {
|
||||
fprintf(stderr, "unable to open /dev/audio -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int flags;
|
||||
if ((flags = fcntl (fd, F_GETFL, 0)) < 0) {
|
||||
fprintf(stderr, "unable to set non-blocking mode for /dev/audio -> no sound\n");
|
||||
return;
|
||||
}
|
||||
flags |= O_NDELAY;
|
||||
if (fcntl (fd, F_SETFL, flags) < 0) {
|
||||
fprintf(stderr, "unable to set non-blocking mode for /dev/audio -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_LINEAR16BIT)) {
|
||||
fprintf(stderr, "unable to select 16bit-linear sample format -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ioctl(fd, AUDIO_SET_SAMPLE_RATE, 44100)) {
|
||||
fprintf(stderr, "unable to select 44.1kHz sample-rate -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ioctl(fd, AUDIO_SET_CHANNELS, 1)) {
|
||||
fprintf(stderr, "unable to select 1-channel playback -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// choose between:
|
||||
// AUDIO_OUT_SPEAKER
|
||||
// AUDIO_OUT_HEADPHONE
|
||||
// AUDIO_OUT_LINE
|
||||
if (ioctl(fd, AUDIO_SET_OUTPUT, AUDIO_OUT_SPEAKER)) {
|
||||
fprintf(stderr, "unable to select audio output -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
// set volume:
|
||||
audio_describe description;
|
||||
audio_gains gains;
|
||||
if (ioctl(fd, AUDIO_DESCRIBE, &description)) {
|
||||
fprintf(stderr, "unable to get audio description -> no sound\n");
|
||||
return;
|
||||
}
|
||||
if (ioctl (fd, AUDIO_GET_GAINS, &gains)) {
|
||||
fprintf(stderr, "unable to get gain values -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
float volume = 1.0;
|
||||
gains.transmit_gain = (int)((float)description.min_transmit_gain +
|
||||
(float)(description.max_transmit_gain
|
||||
- description.min_transmit_gain)
|
||||
* volume);
|
||||
if (ioctl (fd, AUDIO_SET_GAINS, &gains)) {
|
||||
fprintf(stderr, "unable to set gain values -> no sound\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ioctl(fd, AUDIO_SET_TXBUFSIZE, TXBUFSIZE)) {
|
||||
fprintf(stderr, "unable to set transmission buffer size -> no sound\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sound_calc_buf = new int16[TXFRAGSIZE];
|
||||
|
||||
linecnt = 0;
|
||||
|
||||
ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
DigitalRenderer::~DigitalRenderer()
|
||||
{
|
||||
if (fd > 0) {
|
||||
if (ready) {
|
||||
ioctl(fd, AUDIO_DRAIN);
|
||||
}
|
||||
ioctl(fd, AUDIO_RESET);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pause sound output
|
||||
*/
|
||||
|
||||
void DigitalRenderer::Pause(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Resume sound output
|
||||
*/
|
||||
|
||||
void DigitalRenderer::Resume(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fill buffer, sample volume (for sampled voice)
|
||||
*/
|
||||
|
||||
void DigitalRenderer::EmulateLine(void)
|
||||
{
|
||||
sample_buf[sample_in_ptr] = volume;
|
||||
sample_in_ptr = (sample_in_ptr + 1) % SAMPLE_BUF_SIZE;
|
||||
|
||||
// testing the audio status at each raster-line is
|
||||
// really not necessary. Let's do it every 50th one..
|
||||
// ought to be enough by far.
|
||||
|
||||
linecnt--;
|
||||
if (linecnt < 0 && ready) {
|
||||
linecnt = 50;
|
||||
|
||||
// check whether we should add some more data to the
|
||||
// transmission buffer.
|
||||
|
||||
if (ioctl(fd, AUDIO_GET_STATUS, &status)) {
|
||||
fprintf(stderr,"fatal: unable to get audio status\n");
|
||||
exit(20);
|
||||
}
|
||||
|
||||
if (status.transmit_buffer_count < TXLOWWATER) {
|
||||
// add one sound fragment..
|
||||
calc_buffer(sound_calc_buf, TXFRAGSIZE*2);
|
||||
|
||||
// since we've checked for enough space in the transmission buffer,
|
||||
// it is an error if the non-blocking write returns anything but
|
||||
// TXFRAGSIZE*2
|
||||
if (TXFRAGSIZE*2 != write (fd, sound_calc_buf, TXFRAGSIZE*2)) {
|
||||
fprintf(stderr,"fatal: write to audio-device failed\n");
|
||||
exit(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
# This was lifted from the Gimp, and adapted slightly by
|
||||
# Christian Bauer.
|
||||
|
||||
DIE=0
|
||||
|
||||
PROG=Frodo
|
||||
|
||||
# Check how echo works in this /bin/sh
|
||||
case `echo -n` in
|
||||
-n) _echo_n= _echo_c='\c';;
|
||||
*) _echo_n=-n _echo_c=;;
|
||||
esac
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $PROG."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: Missing aclocal. The version of automake"
|
||||
echo "installed doesn't appear recent enough."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.4.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aclocalinclude="$ACLOCAL_FLAGS"; \
|
||||
(echo $_echo_n " + Running aclocal: $_echo_c"; \
|
||||
aclocal $aclocalinclude; \
|
||||
echo "done.") && \
|
||||
(echo $_echo_n " + Running autoheader: $_echo_c"; \
|
||||
autoheader; \
|
||||
echo "done.") && \
|
||||
(echo $_echo_n " + Running autoconf: $_echo_c"; \
|
||||
autoconf; \
|
||||
echo "done.")
|
||||
|
||||
rm -f config.cache
|
||||
|
||||
if [ x"$NO_CONFIGURE" = "x" ]; then
|
||||
echo " + Running 'configure $@':"
|
||||
if [ -z "$*" ]; then
|
||||
echo " ** If you wish to pass arguments to ./configure, please"
|
||||
echo " ** specify them on the command line."
|
||||
fi
|
||||
./configure "$@"
|
||||
fi
|
1465
Src/config.guess
vendored
1465
Src/config.guess
vendored
File diff suppressed because it is too large
Load Diff
1569
Src/config.sub
vendored
1569
Src/config.sub
vendored
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
||||
./configure --host=i386-linux --x-includes=/opt/Qtopia/sharp/include/ --x-libraries=/opt/Qtopia/sharp/lib/ --with-sdl-prefix=/opt/Qtopia/sharp/ --with-embedded-extension=qtopia
|
||||
|
126
Src/configure.ac
126
Src/configure.ac
@ -1,126 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(Frodo, 4.2, [Christian.Bauer@uni-mainz.de], Frodo)
|
||||
AC_CONFIG_SRCDIR(main.cpp)
|
||||
AC_PREREQ(2.52)
|
||||
AC_CONFIG_HEADER(sysconfig.h)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CPP
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl -fomit-frame-pointer makes things faster
|
||||
if [[ x"$GXX" = "xyes" ]]; then
|
||||
CFLAGS="$CFLAGS -fomit-frame-pointer -fno-exceptions"
|
||||
fi
|
||||
|
||||
AC_AIX
|
||||
AC_ISC_POSIX
|
||||
|
||||
dnl Checks for libraries.
|
||||
AC_CHECK_LIB(vga, vga_setmode, HAVE_SVGA_LIB=yes, HAVE_SVGA_LIB=no)
|
||||
AM_PATH_SDL(1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
|
||||
|
||||
EMBEDDED_EXTENSION=none
|
||||
AC_MSG_CHECKING([if Frodo should be compiled with extensions for an embedded device])
|
||||
AC_ARG_WITH([embedded-extension], [AS_HELP_STRING([--with-embedded-extension=qtopia|maemo],[Specify which extension for Frodo on an embedded device should be used.])])
|
||||
if [[ x"$with_embedded_extension" == "xqtopia" ]]; then
|
||||
EMBEDDED_EXTENSION=$with_embedded_extension
|
||||
AC_DEFINE(QTOPIA, 1, [Extension for Qtopia is enabled])
|
||||
elif [[ x"$with_embedded_extension" == "xmaemo" ]]; then
|
||||
EMBEDDED_EXTENSION=$with_embedded_extension
|
||||
AC_DEFINE(MAEMO, 1, [Extension for Maemo is enabled])
|
||||
fi
|
||||
AC_MSG_RESULT([$EMBEDDED_EXTENSION])
|
||||
|
||||
if [[ x"$EMBEDDED_EXTENSION" == "xmaemo" ]]; then
|
||||
PKG_CHECK_MODULES(OSSO, [libosso >= 0.9.19], AC_DEFINE(HAVE_LIBOSSO, [], [Weather libosso is present on the system]), [AC_MSG_NOTICE([libosso not present.])])
|
||||
fi
|
||||
|
||||
if [[ x"$EMBEDDED_EXTENSION" == "xnone" ]]; then
|
||||
HAVE_GLADE=no
|
||||
PKG_CHECK_MODULES(GLADE, libglade-2.0 libgnomeui-2.0 >= 1.110.0, HAVE_GLADE=yes)
|
||||
if [[ $HAVE_GLADE = yes ]]; then
|
||||
AC_DEFINE(HAVE_GLADE, 1, [Glade support is enabled])
|
||||
LDFLAGS="$LDFLAGS -Wl,-E"
|
||||
fi
|
||||
else
|
||||
GUIOBJS="sdlgui.o file.o dlgFileSelect.o dlgMain.o dlgDrives.o dlgOptions.o dlgVideoSound.o dlgAdvanced.o dlgInput.o"
|
||||
GUISRCS="sdlgui.cpp file.cpp dlgFileSelect.cpp dlgMain.cpp dlgDrives.cpp dlgOptions.cpp dlgVidoSound.cpp dlgAdvanced.cpp dlgInput.cpp"
|
||||
fi
|
||||
|
||||
AC_PATH_XTRA
|
||||
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/types.h utime.h string.h strings.h values.h ncurses.h)
|
||||
AC_CHECK_HEADERS(sys/vfs.h sys/mount.h sys/select.h sys/param.h sys/statfs.h sys/statvfs.h sys/stat.h)
|
||||
|
||||
dnl Checks for types.
|
||||
AC_CHECK_SIZEOF(char)
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MEMCMP
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_CHECK_FUNCS(gettimeofday sigaction mkdir rmdir select strerror strstr statfs usleep)
|
||||
|
||||
KBD_LANG=0
|
||||
AC_ARG_ENABLE(kbd-lang-de,[ --enable-kbd-lang-de Use german keyboard layout],[KBD_LANG=1],[])
|
||||
AC_ARG_ENABLE(kbd-lang-us,[ --enable-kbd-lang-us Use american keyboard layout],[KBD_LANG=0],[])
|
||||
|
||||
AC_MSG_CHECKING(which target to use)
|
||||
if [[ x"$no_x" = "xyes" ]]; then
|
||||
if [[ x"$HAVE_SVGA_LIB" = "xyes" ]]; then
|
||||
AC_MSG_RESULT([SVGAlib])
|
||||
TARGET=svgalib
|
||||
CFLAGS="$CFLAGS -D__svgalib__"
|
||||
LIBS="$LIBS -lvga"
|
||||
else
|
||||
AC_MSG_RESULT([Ummm...])
|
||||
AC_MSG_ERROR([Neither X nor SVGAlib found, don't know what target to use.])
|
||||
fi
|
||||
elif [[ x"$HAVE_SDL" = "xyes" ]]; then
|
||||
AC_MSG_RESULT([SDL])
|
||||
TARGET=sdl
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS -DHAVE_SDL"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
else
|
||||
AC_MSG_RESULT([X Window System])
|
||||
TARGET=x11
|
||||
CFLAGS="$CFLAGS $X_CFLAGS -I$ac_cv_x_include"
|
||||
LIBS="$LIBS $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET)
|
||||
AC_SUBST(SET_MAKE)
|
||||
AC_SUBST(top_srcdir)
|
||||
AC_SUBST(HPUX_REV)
|
||||
AC_SUBST(KBD_LANG)
|
||||
AC_SUBST(GUIOBJS)
|
||||
AC_SUBST(GUISRCS)
|
||||
|
||||
dnl Generate Makefile.
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
dnl Print summary.
|
||||
echo
|
||||
echo "Configuration done. Now type \"make\"."
|
@ -1,17 +0,0 @@
|
||||
frodo (4.2.0-7) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Bernd Lachner <dev@lachner-net.de> Wed, 23 Jan 2008 11:15:58 +0100
|
||||
|
||||
* Added Maemo Icon.
|
||||
|
||||
-- Bernd Lachner <dev@lachner-net.de> Wed, 23 Jan 2008 14:30:00 +0100
|
||||
|
||||
* Added Maemo desktop file.
|
||||
|
||||
-- Bernd Lachner <dev@lachner-net.de> Wed, 23 Jan 2008 14:34:00 +0100
|
||||
|
||||
* Added Maemo icons.
|
||||
|
||||
-- Bernd Lachner <dev@lachner-net.de> Wed, 23 Jan 2008 14:35:00 +0100
|
@ -1 +0,0 @@
|
||||
5
|
@ -1,40 +0,0 @@
|
||||
Source: frodo
|
||||
Section: user/other
|
||||
Priority: extra
|
||||
Maintainer: Bernd Lachner <dev@lachner-net.de>
|
||||
Build-Depends: debhelper (>= 5), autotools-dev
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: frodo
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Frodo C64 Emulator
|
||||
A C64 Emulator.
|
||||
XB-Maemo-Icon-26:
|
||||
iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAADAFBMVEUAACkA
|
||||
ABAAABgAACEAAAAAADEAADkAAFIAAFoAAGMAAGsAAHsAAIQAAIwAAJQAAJwA
|
||||
AKUAAK0AALUAAL0AAMYAAM4AAN4AAP8ICL0ICMYICOcICP8QAAAQEPcQEP8Y
|
||||
GBgYGP8hIf8pAAApKSkpKf8xMf85AAA5Of9CAABCQkJCQv9KAABKSkpKSv9S
|
||||
UlJSUv9aAABaWlpaWv9jAABjY2NjY/9ra2tra/9zAABzc/97AAB7e/+EAACE
|
||||
hP+MjIyMjP+UlP+cnP+lAAClpf+tAAC9AAC9vb3GAADGxsbOAADW1tbe3t7n
|
||||
5+fvAAD39/f/AAD/EBD/GBj/KSn/MTH/QkL/////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////2
|
||||
g8mqAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACvAAAArw
|
||||
AUKsNJgAAAAHdElNRQfYARcNEzJj9/E1AAABLklEQVQoz7WSX0+DMBTF2cZE
|
||||
MEPGwrJFpcyBZAjB8WfYKCIzDlIUs8zv/1ks7SAiPvjieWt+t/ec216G+Sed
|
||||
CQLPc7+R6VRR5rLI9TtE9aIwDF1D7BdlC2hODEPXMk1zwduodcVJYtdQZ+PJ
|
||||
VNPbaJEkUJdOAZE6n8jyeDRgCTLSB088AWBpY8VO1XfEImJqptAaYrJGWC8J
|
||||
hPr50Laf3jCyUk/DICfZLhRZ4qo6crKe3Suw2tHUyK4ccSHToDpZsakcA9qC
|
||||
NqzR9t73b1E9OIlRo/3n4bDf3hxv0fBHr4/3LMteHy/z7yPTwqqh799ds2Xr
|
||||
oWRJGNCEOCOtLFQrhlEUhc6sF+wQFU1S5s2n9NrPW7HmK38iplzTBQCgg5g8
|
||||
WC2J+6bobkdZEPO/LdkXNRI8wk8H6PoAAAAASUVORK5CYII=
|
@ -1,22 +0,0 @@
|
||||
This package was debianized by Bernd Lachner <dev@lachner-net.de> on
|
||||
Wed, 23 Jan 2008 11:15:58 +0100.
|
||||
|
||||
It was downloaded from <fill in http/ftp site>
|
||||
|
||||
Upstream Author: <put author(s) name and email here>
|
||||
|
||||
Copyright: <put the year(s) of the copyright, and the names of the
|
||||
copyright holder(s) here>
|
||||
|
||||
License:
|
||||
|
||||
<Put the license of the package here>
|
||||
|
||||
|
||||
The Debian packaging is (C) 2008, Bernd Lachner <dev@lachner-net.de> and
|
||||
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
|
||||
|
||||
|
||||
# Please also look if there are files or directories which have a
|
||||
# different copyright/license attached and list them here.
|
||||
|
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
## ----------------------------------------------------------------------
|
||||
## debian/postinst : postinstallation script for frodo
|
||||
## ----------------------------------------------------------------------
|
||||
|
||||
## ----------------------------------------------------------------------
|
||||
set -e
|
||||
|
||||
chmod +x /usr/bin/mirage
|
||||
echo "updated permiss"
|
||||
|
||||
gtk-update-icon-cache -f /usr/share/icons/hicolor
|
||||
|
||||
|
||||
oldversion="$2"
|
||||
if [ -z "$oldversion" ]; then
|
||||
maemo-select-menu-location frodo.desktop
|
||||
fi
|
||||
|
||||
exit 0
|
107
Src/debian/rules
107
Src/debian/rules
@ -1,107 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
# These are used for cross-compiling and for saving the configure script
|
||||
# from having to guess our platform (since we know it already)
|
||||
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
config.status: configure
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-embedded-extension=maemo --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
|
||||
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: config.status
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
#docbook-to-man debian/frodo.sgml > frodo.1
|
||||
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) distclean
|
||||
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
|
||||
cp -f /usr/share/misc/config.sub config.sub
|
||||
endif
|
||||
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
||||
cp -f /usr/share/misc/config.guess config.guess
|
||||
endif
|
||||
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/frodo.
|
||||
$(MAKE) prefix=$(CURDIR)/debian/frodo/usr install
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_python
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
# dh_perl
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* dlgAdvanced.cpp - SDL GUI dialog for C64 advanced options
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "sdlgui.h"
|
||||
|
||||
#include "Prefs.h"
|
||||
|
||||
enum ADVANCEDDLG {
|
||||
box_main,
|
||||
box_timing,
|
||||
text_timing,
|
||||
text_line_cpu,
|
||||
LINE_CPU,
|
||||
LINE_UP_CPU,
|
||||
LINE_DOWN_CPU,
|
||||
text_bad_line_cpu,
|
||||
BAD_LINE_CPU,
|
||||
BAD_LINE_UP_CPU,
|
||||
BAD_LINE_DOWN_CPU,
|
||||
text_line_cia,
|
||||
LINE_CIA,
|
||||
LINE_UP_CIA,
|
||||
LINE_DOWN_CIA,
|
||||
text_line_1541,
|
||||
LINE_1541,
|
||||
LINE_UP_1541,
|
||||
LINE_DOWN_1541,
|
||||
box_advancedoptions,
|
||||
text_advancedoptions,
|
||||
CLEAR_CIA_ICR,
|
||||
OK,
|
||||
CANCEL
|
||||
};
|
||||
|
||||
static char Cycles[4][4];
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ advanceddlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33,9, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 16, 1, " Timing Control"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 3, 16, 1, "Cycles / Line (CPU):"},
|
||||
{ SGEDITFIELD, 0, 0, 26, 3, sizeof(Cycles[0])-1, 1, Cycles[0]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 3, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 32, 3, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 5, 16, 1, "Cycles / bad line (CPU):"},
|
||||
{ SGEDITFIELD, 0, 0, 26, 5, sizeof(Cycles[1])-1, 1, Cycles[1]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 5, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 32, 5, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 7, 16, 1, "Cycles / Line (CIA):"},
|
||||
{ SGEDITFIELD, 0, 0, 26, 7, sizeof(Cycles[2])-1, 1, Cycles[2]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 7, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 32, 7, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 9, 16, 1, "Cycles / Line (1541):"},
|
||||
{ SGEDITFIELD, 0, 0, 26, 9, sizeof(Cycles[3])-1, 1, Cycles[3]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 9, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 32, 9, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
|
||||
{ SGBOX, 0, 0, 1,13, 33,3, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 12, 22, 1, " Advanced Options"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 14, 30, 1, "Clear CIA ICR on Write Access"},
|
||||
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 1, 18, 6, 1, "OK"},
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 9, 18, 6, 1, "Cancel"},
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
void Dialog_Advanced(Prefs &prefs)
|
||||
{
|
||||
switch (SDLGui_DoDialog(advanceddlg))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,138 +0,0 @@
|
||||
/*
|
||||
* dlgDrives.cpp - SDL GUI dialog for C64 drive settings
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "sdlgui.h"
|
||||
#include "file.h"
|
||||
|
||||
#include "Prefs.h"
|
||||
|
||||
#include "dlgFileSelect.h"
|
||||
|
||||
|
||||
enum DRIVESDLG {
|
||||
box_main,
|
||||
box_drives,
|
||||
text_drives,
|
||||
text_drive8,
|
||||
PATH8TXT,
|
||||
PATH8,
|
||||
text_drive9,
|
||||
PATH9TXT,
|
||||
PATH9,
|
||||
text_drive10,
|
||||
PATH10TXT,
|
||||
PATH10,
|
||||
text_drive11,
|
||||
PATH11TXT,
|
||||
PATH11,
|
||||
box_options,
|
||||
text_options,
|
||||
ENABLE_FULL_1541,
|
||||
MAP_FILE_NAMES,
|
||||
OK,
|
||||
CANCEL
|
||||
};
|
||||
|
||||
static char DrivePath[4][18];
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ drivesdlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33,9, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 13, 1, " Drive Paths"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 3, 8, 1, "Drive 8:"},
|
||||
{ SGEDITFIELD, 0, 0, 12, 3, sizeof(DrivePath[0])-1, 1, DrivePath[0]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 3, 4, 1, "Path"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 5, 16, 1, "Drive 9:"},
|
||||
{ SGEDITFIELD, 0, 0, 12, 5, sizeof(DrivePath[1])-1, 1, DrivePath[1]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 5, 4, 1, "Path"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 7, 16, 1, "Drive 10:"},
|
||||
{ SGEDITFIELD, 0, 0, 12, 7, sizeof(DrivePath[2])-1, 1, DrivePath[2]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 7, 4, 1, "Path"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 9, 16, 1, "Drive 11:"},
|
||||
{ SGEDITFIELD, 0, 0, 12, 9, sizeof(DrivePath[3])-1, 1, DrivePath[3]},
|
||||
{ SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 9, 4, 1, "Path"},
|
||||
|
||||
{ SGBOX, 0, 0, 1,13, 33,3, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 12, 8, 1, " Options"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 14, 30, 1, "Enable Full 1541 Emulation"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 15, 30, 1, "Map '/' to '\\` in File Names"},
|
||||
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 1, 18, 6, 1, "OK"},
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 9, 18, 6, 1, "Cancel"},
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
void Dialog_Drives(Prefs &prefs)
|
||||
{
|
||||
// Set values from prefs
|
||||
// TODO Check length
|
||||
char path[4][MAX_FILENAME_LENGTH];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int widget = PATH8 + i*3;
|
||||
char shrinkedpath[MAX_FILENAME_LENGTH];
|
||||
File_ShrinkName(shrinkedpath, prefs.DrivePath[i], drivesdlg[widget-1].w);
|
||||
strcpy(drivesdlg[widget-1].txt, shrinkedpath);
|
||||
strcpy(path[i], prefs.DrivePath[i]);
|
||||
}
|
||||
drivesdlg[ENABLE_FULL_1541].state |= prefs.Emul1541Proc == true ? SG_SELECTED : 0;
|
||||
drivesdlg[MAP_FILE_NAMES].state |= prefs.MapSlash == true ? SG_SELECTED : 0;
|
||||
while (1)
|
||||
{
|
||||
int widget = SDLGui_DoDialog(drivesdlg);
|
||||
switch (widget)
|
||||
{
|
||||
case PATH8:
|
||||
case PATH9:
|
||||
case PATH10:
|
||||
case PATH11:
|
||||
{
|
||||
if (SDLGui_FileSelect(path[(widget-PATH8)/3], false))
|
||||
{
|
||||
char shrinkedpath[MAX_FILENAME_LENGTH];
|
||||
File_ShrinkName(shrinkedpath, path[(widget-PATH8)/3], drivesdlg[widget-1].w);
|
||||
strcpy(drivesdlg[widget-1].txt, shrinkedpath);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OK:
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
strcpy(prefs.DrivePath[i], path[i]);
|
||||
fprintf (stderr, "Path(%s)\n", prefs.DrivePath[i]);
|
||||
}
|
||||
prefs.Emul1541Proc = drivesdlg[ENABLE_FULL_1541].state &= SG_SELECTED ? true : false;
|
||||
prefs.MapSlash = drivesdlg[MAP_FILE_NAMES].state &= SG_SELECTED ? true : false;
|
||||
return;
|
||||
case CANCEL:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,414 +0,0 @@
|
||||
/*
|
||||
* dlgFileselect.cpp - dialog for selecting files (fileselector box)
|
||||
*
|
||||
* This file is taken from the ARAnyM project which builds a new and powerful
|
||||
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
|
||||
*
|
||||
* Originally taken from the hatari project, thanks Thothy!
|
||||
*
|
||||
* Copyright (c) 2003-2005 ARAnyM dev team (see AUTHORS)
|
||||
*
|
||||
* Frodo 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.
|
||||
*
|
||||
* Frodo 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 Frodo; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include "sdlgui.h"
|
||||
#include "file.h"
|
||||
|
||||
#define SGFSDLG_FILENAME 5
|
||||
#define SGFSDLG_UPDIR 6
|
||||
#define SGFSDLG_ROOTDIR 7
|
||||
#define SGFSDLG_FIRSTENTRY 10
|
||||
#define SGFSDLG_LASTENTRY 24
|
||||
#define SGFSDLG_UP 25
|
||||
#define SGFSDLG_DOWN 26
|
||||
#define SGFSDLG_OKAY 27
|
||||
#define SGFSDLG_CANCEL 28
|
||||
|
||||
#define ENTRY_COUNT (SGFSDLG_LASTENTRY - SGFSDLG_FIRSTENTRY + 1)
|
||||
#define ENTRY_LENGTH 30
|
||||
|
||||
|
||||
static char dlgpath[39], dlgfname[33]; /* File and path name in the dialog */
|
||||
static char dlgfilenames[ENTRY_COUNT][ENTRY_LENGTH + 1];
|
||||
|
||||
/* The dialog data: */
|
||||
static SGOBJ fsdlg[] = {
|
||||
{SGBOX, SG_BACKGROUND, 0, 0, 0, 35, 25, NULL},
|
||||
{SGTEXT, 0, 0, 10, 1, 13, 1, "Choose a file"},
|
||||
{SGTEXT, 0, 0, 1, 2, 7, 1, "Folder:"},
|
||||
{SGTEXT, 0, 0, 1, 3, 33, 1, dlgpath},
|
||||
{SGTEXT, 0, 0, 1, 4, 6, 1, "File:"},
|
||||
{SGTEXT, 0, 0, 7, 4, 26, 1, dlgfname},
|
||||
{SGBUTTON, SG_SELECTABLE | SG_EXIT, 0, 26, 1, 4, 1, ".."},
|
||||
{SGBUTTON, SG_SELECTABLE | SG_EXIT, 0, 31, 1, 3, 1, "/"},
|
||||
{SGBOX, 0, 0, 1, 6, 33, 15, NULL},
|
||||
{SGBOX, 0, 0, 33, 6, 1, 15, NULL},
|
||||
{SGTEXT, 0, 0, 2, 6, ENTRY_LENGTH, 1, dlgfilenames[0]},
|
||||
{SGTEXT, 0, 0, 2, 7, ENTRY_LENGTH, 1, dlgfilenames[1]},
|
||||
{SGTEXT, 0, 0, 2, 8, ENTRY_LENGTH, 1, dlgfilenames[2]},
|
||||
{SGTEXT, 0, 0, 2, 9, ENTRY_LENGTH, 1, dlgfilenames[3]},
|
||||
{SGTEXT, 0, 0, 2, 10, ENTRY_LENGTH, 1, dlgfilenames[4]},
|
||||
{SGTEXT, 0, 0, 2, 11, ENTRY_LENGTH, 1, dlgfilenames[5]},
|
||||
{SGTEXT, 0, 0, 2, 12, ENTRY_LENGTH, 1, dlgfilenames[6]},
|
||||
{SGTEXT, 0, 0, 2, 13, ENTRY_LENGTH, 1, dlgfilenames[7]},
|
||||
{SGTEXT, 0, 0, 2, 14, ENTRY_LENGTH, 1, dlgfilenames[8]},
|
||||
{SGTEXT, 0, 0, 2, 15, ENTRY_LENGTH, 1, dlgfilenames[9]},
|
||||
{SGTEXT, 0, 0, 2, 16, ENTRY_LENGTH, 1, dlgfilenames[10]},
|
||||
{SGTEXT, 0, 0, 2, 17, ENTRY_LENGTH, 1, dlgfilenames[11]},
|
||||
{SGTEXT, 0, 0, 2, 18, ENTRY_LENGTH, 1, dlgfilenames[12]},
|
||||
{SGTEXT, 0, 0, 2, 19, ENTRY_LENGTH, 1, dlgfilenames[13]},
|
||||
{SGTEXT, 0, 0, 2, 20, ENTRY_LENGTH, 1, dlgfilenames[14]},
|
||||
{SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 33, 6, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 33, 20, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
{SGBUTTON, SG_SELECTABLE | SG_EXIT | SG_DEFAULT, 0, 7, 23, 8, 1,
|
||||
"OK"},
|
||||
{SGBUTTON, SG_SELECTABLE | SG_EXIT, 0, 21, 23, 8, 1, "Cancel"},
|
||||
{-1, 0, 0, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
struct listentry {
|
||||
char *filename;
|
||||
bool directory;
|
||||
struct listentry *next;
|
||||
};
|
||||
|
||||
/* Create a sorted list from the directory listing of path */
|
||||
struct listentry *create_list(char *path)
|
||||
{
|
||||
struct listentry *list = NULL;
|
||||
struct listentry *newentry;
|
||||
DIR *dd;
|
||||
struct dirent *direntry;
|
||||
char tempstr[MAX_FILENAME_LENGTH];
|
||||
struct stat filestat;
|
||||
|
||||
if ((dd = opendir(path)) == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((direntry = readdir(dd)) != NULL) {
|
||||
// skip "." name
|
||||
if (strcmp(direntry->d_name, ".") == 0)
|
||||
continue;
|
||||
|
||||
/* Allocate enough memory to store a new list entry and
|
||||
its filemane */
|
||||
newentry =
|
||||
(struct listentry *) malloc(sizeof(struct listentry) +
|
||||
strlen(direntry->d_name) + 1);
|
||||
|
||||
/* Store filename */
|
||||
newentry->filename = (char *) (newentry + 1);
|
||||
strcpy(newentry->filename, direntry->d_name);
|
||||
|
||||
/* Is this entry a directory ? */
|
||||
strcpy(tempstr, path);
|
||||
strcat(tempstr, newentry->filename);
|
||||
if (stat(tempstr, &filestat) == 0 && S_ISDIR(filestat.st_mode))
|
||||
newentry->directory = true;
|
||||
else
|
||||
newentry->directory = false;
|
||||
|
||||
/* Search for right place to insert new entry */
|
||||
struct listentry **prev = &list;
|
||||
struct listentry *next = list;
|
||||
while (next != NULL) {
|
||||
/* directory first, then files */
|
||||
if ((newentry->directory == true)
|
||||
&& (next->directory == false))
|
||||
break;
|
||||
|
||||
/* Sort by name */
|
||||
if ((newentry->directory == next->directory)
|
||||
&& (strcmp(newentry->filename, next->filename) < 0))
|
||||
break;
|
||||
|
||||
prev = &(next->next);
|
||||
next = next->next;
|
||||
}
|
||||
|
||||
/* Insert new entry */
|
||||
newentry->next = next;
|
||||
*prev = newentry;
|
||||
}
|
||||
|
||||
if (closedir(dd) != 0)
|
||||
bug("Error on closedir.");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Free memory allocated for each member of list */
|
||||
void free_list(struct listentry *list)
|
||||
{
|
||||
while (list != NULL) {
|
||||
struct listentry *temp = list;
|
||||
list = list->next;
|
||||
free(temp);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/*
|
||||
Show and process a file selection dialog.
|
||||
Returns TRUE if user selected "OK", FALSE if "cancel".
|
||||
bAllowNew: TRUE if the user is allowed to insert new file names.
|
||||
*/
|
||||
int SDLGui_FileSelect(char *path_and_name, bool bAllowNew)
|
||||
{
|
||||
int i;
|
||||
int ypos = 0;
|
||||
struct listentry *list = NULL;
|
||||
/* The actual file and path names */
|
||||
char path[MAX_FILENAME_LENGTH], fname[128];
|
||||
/* Do we have to reload the directory file list? */
|
||||
bool reloaddir = true;
|
||||
/* Do we have to update the file names in the dialog? */
|
||||
bool refreshentries = true;
|
||||
int retbut;
|
||||
int oldcursorstate;
|
||||
/* The actual selection, -1 if none selected */
|
||||
int selection = -1;
|
||||
bool eol = true;
|
||||
|
||||
if (bAllowNew)
|
||||
fsdlg[SGFSDLG_FILENAME].type = SGEDITFIELD;
|
||||
else
|
||||
fsdlg[SGFSDLG_FILENAME].type = SGTEXT;
|
||||
|
||||
/* Prepare the path and filename variables */
|
||||
File_splitpath(path_and_name, path, fname, NULL);
|
||||
if (strlen(path) == 0) {
|
||||
getcwd(path, sizeof(path));
|
||||
File_AddSlashToEndFileName(path);
|
||||
}
|
||||
File_ShrinkName(dlgpath, path, 38);
|
||||
File_ShrinkName(dlgfname, fname, 32);
|
||||
|
||||
/* Save old mouse cursor state and enable cursor anyway */
|
||||
screenlock();
|
||||
oldcursorstate = SDL_ShowCursor(SDL_QUERY);
|
||||
if (oldcursorstate == SDL_DISABLE)
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
screenunlock();
|
||||
|
||||
do {
|
||||
if (reloaddir) {
|
||||
if (strlen(path) >= MAX_FILENAME_LENGTH) {
|
||||
fprintf(stderr,
|
||||
"SDLGui_FileSelect: Path name too long!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
free_list(list);
|
||||
|
||||
/* Load directory entries: */
|
||||
list = create_list(path);
|
||||
if (list == NULL) {
|
||||
fprintf(stderr, "SDLGui_FileSelect: Path not found.\n");
|
||||
/* reset path and reload entries */
|
||||
strcpy(path, "/");
|
||||
strcpy(dlgpath, path);
|
||||
list = create_list(path);
|
||||
if (list == NULL)
|
||||
/* we're really lost if even root is
|
||||
unreadable */
|
||||
return false;
|
||||
}
|
||||
reloaddir = false;
|
||||
refreshentries = true;
|
||||
}
|
||||
|
||||
if (refreshentries) {
|
||||
struct listentry *temp = list;
|
||||
for (i = 0; i < ypos; i++)
|
||||
temp = temp->next;
|
||||
|
||||
/* Copy entries to dialog: */
|
||||
for (i = 0; i < ENTRY_COUNT; i++) {
|
||||
if (temp != NULL) {
|
||||
char tempstr[MAX_FILENAME_LENGTH];
|
||||
/* Prepare entries: */
|
||||
strcpy(tempstr, " ");
|
||||
strcat(tempstr, temp->filename);
|
||||
File_ShrinkName(dlgfilenames[i], tempstr,
|
||||
ENTRY_LENGTH);
|
||||
/* Mark folders: */
|
||||
if (temp->directory)
|
||||
dlgfilenames[i][0] = SGFOLDER;
|
||||
fsdlg[SGFSDLG_FIRSTENTRY + i].flags =
|
||||
(SG_SELECTABLE | SG_EXIT | SG_RADIO);
|
||||
temp = temp->next;
|
||||
}
|
||||
else {
|
||||
/* Clear entry */
|
||||
dlgfilenames[i][0] = 0;
|
||||
fsdlg[SGFSDLG_FIRSTENTRY + i].flags = 0;
|
||||
}
|
||||
fsdlg[SGFSDLG_FIRSTENTRY + i].state = 0;
|
||||
}
|
||||
|
||||
if (temp == NULL)
|
||||
eol = true;
|
||||
else
|
||||
eol = false;
|
||||
|
||||
refreshentries = false;
|
||||
}
|
||||
|
||||
/* Show dialog: */
|
||||
retbut = SDLGui_DoDialog(fsdlg);
|
||||
|
||||
/* Has the user clicked on a file or folder? */
|
||||
if ((retbut >= SGFSDLG_FIRSTENTRY)
|
||||
&& (retbut <= SGFSDLG_LASTENTRY)) {
|
||||
char tempstr[MAX_FILENAME_LENGTH];
|
||||
struct stat filestat;
|
||||
struct listentry *temp = list;
|
||||
|
||||
strcpy(tempstr, path);
|
||||
for (int i = 0; i < ((retbut - SGFSDLG_FIRSTENTRY) + ypos);
|
||||
i++)
|
||||
temp = temp->next;
|
||||
strcat(tempstr, temp->filename);
|
||||
if (stat(tempstr, &filestat) == 0 && S_ISDIR(filestat.st_mode)) {
|
||||
/* Set the new directory */
|
||||
strcpy(path, tempstr);
|
||||
if (strlen(path) >= 3) {
|
||||
if ((path[strlen(path) - 2] == '/')
|
||||
&& (path[strlen(path) - 1] == '.'))
|
||||
/* Strip a single dot at the
|
||||
end of the path name */
|
||||
path[strlen(path) - 2] = 0;
|
||||
if ((path[strlen(path) - 3] == '/')
|
||||
&& (path[strlen(path) - 2] == '.')
|
||||
&& (path[strlen(path) - 1] == '.')) {
|
||||
/* Handle the ".." folder */
|
||||
char *ptr;
|
||||
if (strlen(path) == 3)
|
||||
path[1] = 0;
|
||||
else {
|
||||
path[strlen(path) - 3] = 0;
|
||||
ptr = strrchr(path, '/');
|
||||
if (ptr)
|
||||
*(ptr + 1) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
File_AddSlashToEndFileName(path);
|
||||
reloaddir = true;
|
||||
/* Copy the path name to the dialog */
|
||||
File_ShrinkName(dlgpath, path, 38);
|
||||
selection = -1; /* Remove old selection */
|
||||
// fname[0] = 0;
|
||||
dlgfname[0] = 0;
|
||||
ypos = 0;
|
||||
}
|
||||
else {
|
||||
/* Select a file */
|
||||
selection = retbut - SGFSDLG_FIRSTENTRY + ypos;
|
||||
strcpy(fname, temp->filename);
|
||||
File_ShrinkName(dlgfname, fname, 32);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Has the user clicked on another button? */
|
||||
switch (retbut) {
|
||||
case SGFSDLG_UPDIR:
|
||||
/* Change path to parent directory */
|
||||
if (strlen(path) > 2) {
|
||||
char *ptr;
|
||||
File_CleanFileName(path);
|
||||
ptr = strrchr(path, '/');
|
||||
if (ptr)
|
||||
*(ptr + 1) = 0;
|
||||
File_AddSlashToEndFileName(path);
|
||||
reloaddir = true;
|
||||
/* Copy the path name to the dialog */
|
||||
File_ShrinkName(dlgpath, path, 38);
|
||||
/* Remove old selection */
|
||||
selection = -1;
|
||||
fname[0] = 0;
|
||||
dlgfname[0] = 0;
|
||||
ypos = 0;
|
||||
}
|
||||
break;
|
||||
case SGFSDLG_ROOTDIR:
|
||||
/* Change to root directory */
|
||||
strcpy(path, "/");
|
||||
reloaddir = true;
|
||||
strcpy(dlgpath, path);
|
||||
/* Remove old selection */
|
||||
selection = -1;
|
||||
fname[0] = 0;
|
||||
dlgfname[0] = 0;
|
||||
ypos = 0;
|
||||
break;
|
||||
case SGFSDLG_UP:
|
||||
/* Scroll up */
|
||||
if (ypos > 0) {
|
||||
--ypos;
|
||||
refreshentries = true;
|
||||
}
|
||||
SDL_Delay(20);
|
||||
break;
|
||||
case SGFSDLG_DOWN:
|
||||
/* Scroll down */
|
||||
if (eol == false) {
|
||||
++ypos;
|
||||
refreshentries = true;
|
||||
}
|
||||
SDL_Delay(20);
|
||||
break;
|
||||
} /* switch */
|
||||
} /* other button code */
|
||||
|
||||
}
|
||||
while ((retbut != SGFSDLG_OKAY) && (retbut != SGFSDLG_CANCEL)
|
||||
&& (retbut != -1));
|
||||
|
||||
screenlock();
|
||||
if (oldcursorstate == SDL_DISABLE)
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
screenunlock();
|
||||
|
||||
{
|
||||
/* if user edited filename, use new one */
|
||||
char dlgfname2[33];
|
||||
File_ShrinkName(dlgfname2, fname, 32);
|
||||
if (strcmp(dlgfname, dlgfname2) != 0)
|
||||
strcpy(fname, dlgfname);
|
||||
}
|
||||
|
||||
File_makepath(path_and_name, path, fname, NULL);
|
||||
|
||||
free_list(list);
|
||||
|
||||
return (retbut == SGFSDLG_OKAY);
|
||||
}
|
||||
|
||||
/*
|
||||
vim:ts=4:sw=4:
|
||||
*/
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* dlgFileSelect.h - SDL GUI dialog for file selection
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* Originally taken from the hatari project,
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
int SDLGui_FileSelect(char *path_and_name, bool bAllowNew);
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* dlgInput.cpp - SDL GUI dialog for C64 input options
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "sdlgui.h"
|
||||
|
||||
#include "Prefs.h"
|
||||
|
||||
enum INPUTDLG {
|
||||
box_main,
|
||||
box_timing,
|
||||
text_timing,
|
||||
text_line_cpu,
|
||||
LINE_CPU,
|
||||
LINE_UP_CPU,
|
||||
LINE_DOWN_CPU,
|
||||
text_bad_line_cpu,
|
||||
BAD_LINE_CPU,
|
||||
BAD_LINE_UP_CPU,
|
||||
BAD_LINE_DOWN_CPU,
|
||||
text_line_cia,
|
||||
LINE_CIA,
|
||||
LINE_UP_CIA,
|
||||
LINE_DOWN_CIA,
|
||||
text_line_1541,
|
||||
LINE_1541,
|
||||
LINE_UP_1541,
|
||||
LINE_DOWN_1541,
|
||||
box_advancedoptions,
|
||||
text_advancedoptions,
|
||||
CLEAR_CIA_ICR,
|
||||
OK,
|
||||
CANCEL
|
||||
};
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ inputdlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33,9, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 11, 1, " Joysticks"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 3, 30, 1, "Swap Joysticks"},
|
||||
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 1, 18, 6, 1, "OK"},
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 9, 18, 6, 1, "Cancel"},
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
void Dialog_Input(Prefs &prefs)
|
||||
{
|
||||
switch (SDLGui_DoDialog(inputdlg))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
113
Src/dlgMain.cpp
113
Src/dlgMain.cpp
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* dlgMain.cpp - Main SDL GUI dialog
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "dlgMain.h"
|
||||
#include "sdlgui.h"
|
||||
|
||||
extern void Dialog_Drives(Prefs &prefs);
|
||||
extern void Dialog_Options(Prefs &prefs);
|
||||
extern void Dialog_VideoSound(Prefs &prefs);
|
||||
extern void Dialog_Advanced(Prefs &prefs);
|
||||
extern void Dialog_Input(Prefs &prefs);
|
||||
|
||||
enum MAINDLG {
|
||||
box_main,
|
||||
box_settings,
|
||||
text_settings,
|
||||
DRIVES,
|
||||
VIDEOSOUND,
|
||||
INPUT,
|
||||
OPTIONS,
|
||||
ADVANCED,
|
||||
APPLY,
|
||||
CANCEL,
|
||||
SAVE,
|
||||
box_quickaccess,
|
||||
text_quickaccess,
|
||||
RESET,
|
||||
QUIT,
|
||||
ABOUT
|
||||
};
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ maindlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33,10, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 16, 1, " Frodo Settings "},
|
||||
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 2, 3, 14,1, "Drives" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 2, 5, 14,1, "Video/Sound" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 2, 7, 14,1, "Input" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 18,3, 14,1, "Options" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 18,5, 14,1, "Advanced" },
|
||||
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 2,10,8,1, "Apply" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 13,10, 8,1, "Cancel" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 24,10, 8,1, "Save" },
|
||||
|
||||
{ SGBOX, 0, 0, 1,15, 33,3, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 14, 22, 1, " Quick-Access-Buttons "},
|
||||
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 2,16,8,1, "Reset" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 13,16, 8,1, "Quit" },
|
||||
{ SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 24,16, 8,1, "About" },
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
int Dialog_Main(Prefs &prefs)
|
||||
{
|
||||
// apply
|
||||
while (1)
|
||||
{
|
||||
switch (SDLGui_DoDialog(maindlg))
|
||||
{
|
||||
case DRIVES:
|
||||
Dialog_Drives(prefs);
|
||||
break;
|
||||
case OPTIONS:
|
||||
Dialog_Options(prefs);
|
||||
break;
|
||||
case VIDEOSOUND:
|
||||
Dialog_VideoSound(prefs);
|
||||
break;
|
||||
case ADVANCED:
|
||||
Dialog_Advanced(prefs);
|
||||
break;
|
||||
case INPUT:
|
||||
Dialog_Input(prefs);
|
||||
break;
|
||||
case APPLY:
|
||||
return DO_USEPREFS;
|
||||
case SAVE:
|
||||
return DO_SAVEPREFS;
|
||||
case RESET:
|
||||
return DO_RESET;
|
||||
case QUIT:
|
||||
return DO_QUIT;
|
||||
case CANCEL:
|
||||
return DO_NOTHING;
|
||||
}
|
||||
}
|
||||
return DO_NOTHING;
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* dlgMain.h - Main SDL GUI dialog
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
const int DO_NOTHING = 1;
|
||||
const int DO_QUIT = 2;
|
||||
const int DO_RESET = 3;
|
||||
const int DO_USEPREFS = 4;
|
||||
const int DO_SAVEPREFS = 5;
|
||||
|
||||
class Prefs;
|
||||
|
||||
int Dialog_Main(Prefs &prefs);
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* dlgOptions.cpp - SDL GUI dialog for C64 emulator options
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "sdlgui.h"
|
||||
|
||||
#include "Prefs.h"
|
||||
|
||||
enum OPTIONSDDLG {
|
||||
box_main,
|
||||
box_speedcontrol,
|
||||
text_speedcontrol,
|
||||
text_draweverynthframe,
|
||||
DRAW_EVERYNTH_FRAME,
|
||||
DRAW_EVERYNTH_FRAME_UP,
|
||||
DRAW_EVERYNTH_FRAME_DOWN,
|
||||
LIMIT_SPEED_TO100PERCENT,
|
||||
FAST_RESET,
|
||||
box_memoryexpansion,
|
||||
text_memoryexpansion,
|
||||
text_reu_size,
|
||||
RADIO_REU_NONE,
|
||||
RADIO_REU_128K,
|
||||
RADIO_REU_256K,
|
||||
RADIO_REU_512K,
|
||||
OK,
|
||||
CANCEL
|
||||
};
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ optionsdlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33,9, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 15, 1, " Speed Control"},
|
||||
|
||||
{ SGTEXT, 0, 0, 2, 3, 16, 1, "Draw every n-th frame:"},
|
||||
{ SGEDITFIELD, 0, 0, 26, 3, 3, 1, " "},
|
||||
{SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 30, 3, 1, 1, "\x01"},
|
||||
/* Arrow up */
|
||||
{SGBUTTON, SG_SELECTABLE | SG_TOUCHEXIT, 0, 32, 3, 1, 1, "\x02"},
|
||||
/* Arrow down */
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 5, 30, 1, "Limit Speed to 100%"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 7, 30, 1, "Fast Reset"},
|
||||
|
||||
{ SGBOX, 0, 0, 1,13, 33,3, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 12, 18, 1, " Memory Expansion"},
|
||||
{ SGTEXT, 0, 0, 2, 14, 30, 1, "REU Size:"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 2, 15, 4, 1, "None" },
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 10, 15, 20,1, "128K" },
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 18, 15, 20,1, "256K" },
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 26, 15, 20,1, "512K" },
|
||||
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 1, 18, 6, 1, "OK"},
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 9, 18, 6, 1, "Cancel"},
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
void Dialog_Options(Prefs &prefs)
|
||||
{
|
||||
// Set values from prefs
|
||||
// TODO optionsdlg[DRAW_EVERYNTH_FRAME].txt = prefs.SkipFrames;
|
||||
optionsdlg[LIMIT_SPEED_TO100PERCENT].state |= prefs.LimitSpeed == true ? SG_SELECTED : 0;
|
||||
optionsdlg[FAST_RESET].state |= prefs.FastReset == true ? SG_SELECTED : 0;
|
||||
switch (prefs.REUSize)
|
||||
{
|
||||
case REU_NONE:
|
||||
optionsdlg[RADIO_REU_NONE].state |= SG_SELECTED;
|
||||
break;
|
||||
case REU_128K:
|
||||
optionsdlg[RADIO_REU_128K].state |= SG_SELECTED;
|
||||
break;
|
||||
case REU_256K:
|
||||
optionsdlg[RADIO_REU_256K].state |= SG_SELECTED;
|
||||
break;
|
||||
case REU_512K:
|
||||
optionsdlg[RADIO_REU_512K].state |= SG_SELECTED;
|
||||
break;
|
||||
}
|
||||
switch (SDLGui_DoDialog(optionsdlg))
|
||||
{
|
||||
case OK:
|
||||
// Set values to prefs
|
||||
prefs.LimitSpeed = optionsdlg[LIMIT_SPEED_TO100PERCENT].state &= SG_SELECTED ? true : false;
|
||||
prefs.FastReset = optionsdlg[FAST_RESET].state &= SG_SELECTED ? true : false;
|
||||
for (int i = RADIO_REU_NONE; i <= RADIO_REU_512K; i++)
|
||||
{
|
||||
if (optionsdlg[i].state &= SG_SELECTED)
|
||||
{
|
||||
prefs.REUSize = i - RADIO_REU_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* dlgVideoSound.cpp - SDL GUI dialog for C64 video and sound options
|
||||
*
|
||||
* (C) 2006 Bernd Lachner
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "sdlgui.h"
|
||||
|
||||
#include "Prefs.h"
|
||||
|
||||
enum VIDEOSOUNDDDLG {
|
||||
box_main,
|
||||
box_timing,
|
||||
text_timing,
|
||||
text_line_cpu,
|
||||
LINE_CPU,
|
||||
LINE_UP_CPU,
|
||||
LINE_DOWN_CPU,
|
||||
text_bad_line_cpu,
|
||||
BAD_LINE_CPU,
|
||||
BAD_LINE_UP_CPU,
|
||||
BAD_LINE_DOWN_CPU,
|
||||
text_line_cia,
|
||||
LINE_CIA,
|
||||
LINE_UP_CIA,
|
||||
LINE_DOWN_CIA,
|
||||
text_line_1541,
|
||||
LINE_1541,
|
||||
LINE_UP_1541,
|
||||
LINE_DOWN_1541,
|
||||
box_advancedoptions,
|
||||
text_advancedoptions,
|
||||
CLEAR_CIA_ICR,
|
||||
OK,
|
||||
CANCEL
|
||||
};
|
||||
|
||||
/* The keyboard dialog: */
|
||||
/* Spalte, Zeile, Länge, Höhe*/
|
||||
static SGOBJ videosounddlg[] =
|
||||
{
|
||||
{ SGBOX, SG_BACKGROUND, 0, 0,0, 35,20, NULL },
|
||||
{ SGBOX, 0, 0, 1,2, 33, 7, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 1, 15, 1, " Video Options"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 3, 30, 1, "Display Sprites"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 5, 30, 1, "Detect Sprite Collisions"},
|
||||
|
||||
{ SGBOX, 0, 0, 1, 11, 33, 5, NULL },
|
||||
{ SGTEXT, 0, 0, 2, 10, 15, 1, " Sound Options"},
|
||||
{ SGTEXT, 0, 0, 2, 12, 10, 1, "Sound Emu:"},
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 13, 12, 12, 1, "Off" },
|
||||
{ SGCHECKBOX, SG_SELECTABLE|SG_RADIO, 0, 20, 12, 20,1, "Software" },
|
||||
{ SGCHECKBOX, SG_SELECTABLE, 0, 2, 14, 30, 1, "Enable SID Filters"},
|
||||
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT|SG_DEFAULT, 0, 1, 18, 6, 1, "OK"},
|
||||
{SGBUTTON, SG_SELECTABLE|SG_EXIT, 0, 9, 18, 6, 1, "Cancel"},
|
||||
|
||||
{ -1, 0, 0, 0,0, 0,0, NULL }
|
||||
};
|
||||
|
||||
void Dialog_VideoSound(Prefs &prefs)
|
||||
{
|
||||
switch (SDLGui_DoDialog(videosounddlg))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
188
Src/el_Acorn.h
188
Src/el_Acorn.h
@ -1,188 +0,0 @@
|
||||
/*
|
||||
* el_Acorn.h - Somewhat faster (on Acorn) versions of the el_-functions
|
||||
* of VIC.cpp
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
register uint32 *lp = (uint32 *)p, *t;
|
||||
uint8 *cp = color_line;
|
||||
uint8 *mp = matrix_line;
|
||||
uint32 *tab = (uint32*)&TextColorTable[0][b0c][0][0];
|
||||
|
||||
// Loop for 40 characters
|
||||
for (int i=0; i<40; i++) {
|
||||
uint8 data = r[i] = q[mp[i] << 3];
|
||||
|
||||
t = tab + ((cp[i] & 15) << 13) + (data << 1);
|
||||
*lp++ = *t++; *lp++ = *t++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
register uint32 *wp = (uint32 *)p, *t;
|
||||
uint32 *tab = (uint32*)&TextColorTable[0][b0c][0][0];
|
||||
uint8 *cp = color_line;
|
||||
uint8 *mp = matrix_line;
|
||||
uint8 *lookup = (uint8*)mc_color_lookup;
|
||||
|
||||
// Loop for 40 characters
|
||||
for (int i=0; i<40; i++) {
|
||||
register uint32 color = cp[i];
|
||||
uint8 data = q[mp[i] << 3];
|
||||
|
||||
if (color & 8) {
|
||||
r[i] = (data & 0xaa) | (data & 0xaa) >> 1;
|
||||
lookup[6] = colors[color & 7];
|
||||
color = lookup[(data & 0xc0) >> 5] | (lookup[(data & 0x30) >> 3] << 16);
|
||||
*wp++ = color | (color << 8);
|
||||
color = lookup[(data & 0x0c) >> 1] | (lookup[(data & 0x03) << 1] << 16);
|
||||
*wp++ = color | (color << 8);
|
||||
|
||||
} else { // Standard mode in multicolor mode
|
||||
r[i] = data;
|
||||
color = cp[i]; t = tab + (color << 13) + (data << 1);
|
||||
*wp++ = *t++; *wp++ = *t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
register uint32 *lp = (uint32 *)p, *t;
|
||||
uint8 *mp = matrix_line;
|
||||
|
||||
// Loop for 40 characters
|
||||
for (int i=0; i<40; i++, q+=8) {
|
||||
uint8 data = r[i] = *q;
|
||||
uint8 h = mp[i];
|
||||
|
||||
t = (uint32*)&TextColorTable[h >> 4][h & 15][data][0];
|
||||
*lp++ = *t++; *lp++ = *t++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
uint8 lookup[4];
|
||||
register uint32 *wp = (uint32 *)p;
|
||||
uint8 *cp = color_line;
|
||||
uint8 *mp = matrix_line;
|
||||
|
||||
lookup[0] = b0c_color;
|
||||
|
||||
// Loop for 40 characters
|
||||
for (int i=0; i<40; i++, q+=8) {
|
||||
uint8 data = *q;
|
||||
register uint32 h = mp[i];
|
||||
|
||||
lookup[1] = colors[h >> 4];
|
||||
lookup[2] = colors[h];
|
||||
lookup[3] = colors[cp[i]];
|
||||
|
||||
r[i] = (data & 0xaa) | (data & 0xaa) >> 1;
|
||||
|
||||
h = lookup[data >> 6] | (lookup[(data >> 4) & 3] << 16); *wp++ = h | (h << 8);
|
||||
h = lookup[(data >> 2) & 3] | (lookup[data & 3] << 16); *wp++ = h | (h << 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
register uint32 *lp = (uint32 *)p, *t;
|
||||
uint8 *cp = color_line;
|
||||
uint8 *mp = matrix_line;
|
||||
uint8 *bcp = &b0c;
|
||||
|
||||
// Loop for 40 characters
|
||||
for (int i=0; i<40; i++) {
|
||||
uint8 data = r[i] = mp[i];
|
||||
|
||||
t = (uint32*)&TextColorTable[cp[i]][bcp[(data >> 6) & 3]][q[(data & 0x3f) << 3]][0];
|
||||
*lp++ = *t++; *lp++ = *t++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_std_idle(uint8 *p, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_std_idle(uint8 *p, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
uint8 data = *get_physical(ctrl1 & 0x40 ? 0x39ff : 0x3fff);
|
||||
uint32 *lp = (uint32 *)p;
|
||||
uint32 conv0 = TextColorTable[0][b0c][data][0].b;
|
||||
uint32 conv1 = TextColorTable[0][b0c][data][1].b;
|
||||
|
||||
for (int i=0; i<40; i++) {
|
||||
*lp++ = conv0;
|
||||
*lp++ = conv1;
|
||||
*r++ = data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL_VARS
|
||||
static inline void el_mc_idle(uint8 *p, uint8 *r)
|
||||
#else
|
||||
inline void MOS6569::el_mc_idle(uint8 *p, uint8 *r)
|
||||
#endif
|
||||
{
|
||||
uint8 data = *get_physical(0x3fff);
|
||||
register uint8 c0 = b0c_color, c1 = colors[0];
|
||||
register uint32 *lp = (uint32 *)p;
|
||||
register uint32 conv0, conv1;
|
||||
|
||||
conv0 = (((data & 0xc0) == 0) ? c0 : c1) | (((data & 0x30) == 0) ? c0<<16 : c1<<16);
|
||||
conv1 = (((data & 0x0c) == 0) ? c0 : c1) | (((data & 0x03) == 0) ? c0<<16 : c1<<16);
|
||||
conv0 |= (conv0 << 8); conv1 |= (conv1 << 8);
|
||||
|
||||
for (int i=0; i<40; i++) {
|
||||
*lp++ = conv0;
|
||||
*lp++ = conv1;
|
||||
*r++ = data;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
||||
|
||||
<glade-project>
|
||||
<name>Frodo</name>
|
||||
<program_name>Frodo</program_name>
|
||||
<gettext_support>FALSE</gettext_support>
|
||||
<output_build_files>FALSE</output_build_files>
|
||||
</glade-project>
|
251
Src/install-sh
251
Src/install-sh
@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
@ -1,8 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Version=4.3
|
||||
Type=Application
|
||||
Name=Frodo
|
||||
Exec=/usr/bin/Frodo
|
||||
X-Osso-Service=de.lachner_net.frodo
|
||||
Icon=frodo
|
@ -1,3 +0,0 @@
|
||||
[D-BUS Service]
|
||||
Name=de.lachner_net.frodo
|
||||
Exec=/usr/bin/Frodo
|
576
Src/main_Acorn.h
576
Src/main_Acorn.h
@ -1,576 +0,0 @@
|
||||
/*
|
||||
* main_Acorn.h - Main program, RISC OS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "ROlib.h"
|
||||
#include "AcornGUI.h"
|
||||
|
||||
|
||||
// Shared, system-specific data
|
||||
// The application
|
||||
Frodo *the_app;
|
||||
|
||||
// My task handle
|
||||
unsigned int TaskHandle;
|
||||
|
||||
int WimpMessages[] = {
|
||||
Message_DataSave, Message_DataSaveAck, Message_DataLoad, Message_DataLoadAck,
|
||||
Message_DataOpen, Message_PaletteChange, Message_ModeChange, Message_MenuWarning, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// RORes member-functions - very simple reading of screen res and eigen
|
||||
RORes::RORes(void)
|
||||
{
|
||||
resx = OS_ReadModeVariable(-1,11); resy = OS_ReadModeVariable(-1,12);
|
||||
eigx = OS_ReadModeVariable(-1,4) ; eigy = OS_ReadModeVariable(-1,5);
|
||||
resx = (resx+1)<<eigx; resy = (resy+1)<<eigy;
|
||||
}
|
||||
|
||||
RORes::~RORes(void) {;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ROScreen member-functions - handle currently selected screenmode
|
||||
ROScreen::ROScreen(void)
|
||||
{
|
||||
if (ReadMode() != 0)
|
||||
{
|
||||
ModeError.errnum = 0x0; strcpy((char*)&ModeError.errmess,"Can't read mode data!");
|
||||
Wimp_ReportError(&ModeError,1,TASKNAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ROScreen::~ROScreen(void) {;}
|
||||
|
||||
|
||||
// read data for current screenmode, returns 0 if OK, > 0 if error
|
||||
int ROScreen::ReadMode(void)
|
||||
{
|
||||
register int h=0;
|
||||
|
||||
if ((resx = OS_ReadModeVariable(-1,11)) < 0) h++;
|
||||
if ((resy = OS_ReadModeVariable(-1,12)) < 0) h++;
|
||||
if ((eigx = OS_ReadModeVariable(-1,4)) < 0) h++;
|
||||
if ((eigy = OS_ReadModeVariable(-1,5)) < 0) h++;
|
||||
resx = (resx+1)<<eigx; resy = (resy+1)<<eigy;
|
||||
if ((ldbpp = OS_ReadModeVariable(-1,9)) < 0) h++;
|
||||
if ((ladd = OS_ReadModeVariable(-1,6)) < 0) h++;
|
||||
scrbase = (char*)OS_ReadDynamicArea(2);
|
||||
if (eigx > eigy)
|
||||
{
|
||||
ModeError.errnum = 0x0;
|
||||
sprintf((char*)ModeError.errmess,"Can't handle screen modes with eigen_x > eigen_y!");
|
||||
Wimp_ReportError(&ModeError,1,TASKNAME);
|
||||
}
|
||||
return(h);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Window member-functions - handle all things concerned with windows
|
||||
// WDesc is a pointer to a complete window descriptor (incl. Handle at pos 0!)
|
||||
Window::Window(const int *WDesc, const char *Title)
|
||||
{
|
||||
register int h;
|
||||
|
||||
wind = (RO_Window *)WDesc;
|
||||
if (Title != NULL)
|
||||
{
|
||||
if ((wind->tflags & IFlg_Indir) != 0)
|
||||
{
|
||||
strcpy((char*)(wind->dat.ind.tit),Title); // indirected
|
||||
}
|
||||
else {strncpy((char *)&wind->dat,Title,12);}
|
||||
}
|
||||
if ((wind->Handle = Wimp_CreateWindow((int*)&wind->vminx)) == 0)
|
||||
{
|
||||
_kernel_oserror WindError;
|
||||
|
||||
WindError.errnum = 0x0; strcpy((char*)WindError.errmess,"Can't create window!");
|
||||
Wimp_ReportError(&WindError,1,TASKNAME);
|
||||
}
|
||||
// Isopen is unreliable. Works only if the window is never opened/closed by other
|
||||
// means than calling the member-functions. For 100% accuracy use OpenStatus().
|
||||
isopen = false;
|
||||
}
|
||||
|
||||
|
||||
Window::~Window(void)
|
||||
{
|
||||
Wimp_DeleteWindow((int*)wind);
|
||||
}
|
||||
|
||||
|
||||
int Window::MyHandle(void)
|
||||
{
|
||||
return(wind->Handle);
|
||||
}
|
||||
|
||||
|
||||
void Window::GetWorkArea(int *Dest)
|
||||
{
|
||||
Dest[0] = wind->wminx; Dest[1] = wind->wminy;
|
||||
Dest[2] = wind->wmaxx; Dest[3] = wind->wmaxy;
|
||||
}
|
||||
|
||||
|
||||
void Window::open(void) {isopen = true; Wimp_OpenWindow((int*)wind);}
|
||||
|
||||
|
||||
void Window::open(int *Block) {isopen = true; Wimp_OpenWindow(Block);}
|
||||
|
||||
|
||||
void Window::close(void) {isopen = false; Wimp_CloseWindow((int*)wind);}
|
||||
|
||||
|
||||
void Window::forceredraw(int minx, int miny, int maxx, int maxy)
|
||||
{
|
||||
Wimp_ForceRedraw(wind->Handle,minx,miny,maxx,maxy);
|
||||
}
|
||||
|
||||
|
||||
void Window::redraw(int *Block, uint8 *Bitmap, C64Display *Disp)
|
||||
{
|
||||
int more;
|
||||
|
||||
more = Wimp_RedrawWindow(Block);
|
||||
while (more != 0)
|
||||
{
|
||||
RedrawAWindow(Block,Bitmap,Disp);
|
||||
more = Wimp_GetRectangle(Block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Block contains the coordinates to update, the handle is entered by this
|
||||
// memberfunction
|
||||
void Window::update(int *Block, uint8 *Bitmap, C64Display *Disp)
|
||||
{
|
||||
int more;
|
||||
|
||||
Block[0] = wind->Handle;
|
||||
more = Wimp_UpdateWindow(Block);
|
||||
while (more != 0)
|
||||
{
|
||||
RedrawAWindow(Block,Bitmap,Disp);
|
||||
more = Wimp_GetRectangle(Block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This updated the entire window
|
||||
void Window::update(uint8 *Bitmap, C64Display *Disp)
|
||||
{
|
||||
int more;
|
||||
int Block[11];
|
||||
|
||||
Block[0] = wind->Handle;
|
||||
GetWorkArea(Block+1);
|
||||
more = Wimp_UpdateWindow(Block);
|
||||
while (more != 0)
|
||||
{
|
||||
RedrawAWindow(Block,Bitmap,Disp);
|
||||
more = Wimp_GetRectangle(Block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Window::extent(int minx, int miny, int maxx, int maxy)
|
||||
{
|
||||
int extent[4];
|
||||
|
||||
extent[0] = minx; extent[1] = miny; extent[2] = maxx; extent[3] = maxy;
|
||||
Wimp_SetExtent(wind->Handle,(int*)extent);
|
||||
// update internal window info as well
|
||||
wind->wminx = minx; wind->wminy = miny;
|
||||
wind->wmaxx = maxx; wind->wmaxy = maxy;
|
||||
}
|
||||
|
||||
|
||||
void Window::getstate(void) {Wimp_GetWindowState((int*)wind);}
|
||||
|
||||
|
||||
void Window::getstate(int *dest)
|
||||
{
|
||||
dest[0] = wind->Handle;
|
||||
Wimp_GetWindowState(dest);
|
||||
}
|
||||
|
||||
|
||||
// The actual redrawing: if the bitmap pointer is not NULL the bitmap is
|
||||
// painted into the window.
|
||||
void Window::RedrawAWindow(int *Block, uint8 *Bitmap, C64Display *Disp)
|
||||
{
|
||||
if (Bitmap != NULL)
|
||||
{
|
||||
// Plot the bitmap into the window
|
||||
graph_env ge;
|
||||
unsigned int *ct;
|
||||
|
||||
// Coordinates are TOP left of rectangle (not bottom, like in RO)
|
||||
ge.x = Block[RedrawB_VMinX] - Block[RedrawB_ScrollX];
|
||||
ge.y = Block[RedrawB_VMaxY] - Block[RedrawB_ScrollY];
|
||||
ge.dimx = DISPLAY_X; ge.dimy = DISPLAY_Y;
|
||||
ct = Disp->GetColourTable();
|
||||
|
||||
if (Disp->TheC64->TheWIMP->ReadEmuWindowSize() == 1)
|
||||
{
|
||||
PlotZoom1(&ge,&Block[RedrawB_CMinX],Bitmap,ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlotZoom2(&ge,&Block[RedrawB_CMinX],Bitmap,ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns a pointer to a window's icon (or NULL of invalid number)
|
||||
RO_Icon *Window::GetIcon(unsigned int number)
|
||||
{
|
||||
if (number > wind->icon_no) {return(NULL);}
|
||||
return((RO_Icon*)(((int*)wind) + RO_WINDOW_WORDS + RO_ICON_WORDS*number));
|
||||
}
|
||||
|
||||
|
||||
void Window::SetIconState(unsigned int number, unsigned int eor, unsigned int clear)
|
||||
{
|
||||
int Block[4];
|
||||
|
||||
Block[0] = wind->Handle; Block[1] = number; Block[2] = eor; Block[3] = clear;
|
||||
Wimp_SetIconState((int*)Block);
|
||||
}
|
||||
|
||||
|
||||
void Window::GetIconState(unsigned int number, int *Block)
|
||||
{
|
||||
Block[0] = wind->Handle; Block[1] = number;
|
||||
Wimp_GetIconState(Block);
|
||||
}
|
||||
|
||||
|
||||
// Returns true if this window has the input focus
|
||||
bool Window::HaveInput(void)
|
||||
{
|
||||
RO_Caret Store;
|
||||
|
||||
Wimp_GetCaretPosition(&Store);
|
||||
return(Store.WHandle == wind->Handle);
|
||||
}
|
||||
|
||||
|
||||
// Writes text into an indirected icon
|
||||
void Window::WriteIconText(unsigned int number, const char *text)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
// This only makes sense for indirected icons!
|
||||
if ((ic->iflags & IFlg_Indir) != 0)
|
||||
{
|
||||
strncpy((char*)ic->dat.ind.tit,text,ic->dat.ind.len);
|
||||
ForceIconRedraw(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The same but update the window (i.e. immediate result)
|
||||
void Window::WriteIconTextU(unsigned int number, const char *text)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
if ((ic->iflags & IFlg_Indir) != 0)
|
||||
{
|
||||
strncpy((char*)ic->dat.ind.tit,text,ic->dat.ind.len);
|
||||
UpdateIcon(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Writes the value as a decimal string into the indirected icon
|
||||
void Window::WriteIconNumber(unsigned int number, int value)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
if ((ic->iflags & IFlg_Indir) != 0)
|
||||
{
|
||||
ConvertInteger4(value,(char*)ic->dat.ind.tit,ic->dat.ind.len);
|
||||
ForceIconRedraw(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The same but update the window
|
||||
void Window::WriteIconNumberU(unsigned int number, int value)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
if ((ic->iflags & IFlg_Indir) != 0)
|
||||
{
|
||||
ConvertInteger4(value,(char*)ic->dat.ind.tit,ic->dat.ind.len);
|
||||
UpdateIcon(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns a pointer to the text in the icon
|
||||
char *Window::ReadIconText(unsigned int number)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
// only indirected icons!
|
||||
if ((ic->iflags & IFlg_Indir) != 0) {return((char*)ic->dat.ind.tit);}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
// Reads the number in an indirected icon.
|
||||
int Window::ReadIconNumber(unsigned int number)
|
||||
{
|
||||
RO_Icon *ic;
|
||||
|
||||
if ((ic = GetIcon(number)) != NULL)
|
||||
{
|
||||
if ((ic->iflags & IFlg_Indir) != 0)
|
||||
{
|
||||
return(atoi((char*)ic->dat.ind.tit));
|
||||
}
|
||||
}
|
||||
return(-1); // rather arbitrary, but we only have positive numbers here...
|
||||
}
|
||||
|
||||
|
||||
void Window::WriteTitle(const char *title)
|
||||
{
|
||||
// only indirected window titles, must contain text
|
||||
if ((wind->tflags & (IFlg_Indir | IFlg_Text)) == (IFlg_Indir | IFlg_Text))
|
||||
{
|
||||
strcpy((char*)wind->dat.ind.tit,title);
|
||||
UpdateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *Window::ReadTitle(void)
|
||||
{
|
||||
if ((wind->tflags & (IFlg_Indir | IFlg_Text)) == (IFlg_Indir | IFlg_Text))
|
||||
{
|
||||
return((char*)wind->dat.ind.tit);
|
||||
}
|
||||
else {return(NULL);}
|
||||
}
|
||||
|
||||
|
||||
// Forces a redraw of the window title
|
||||
void Window::UpdateTitle(void)
|
||||
{
|
||||
getstate();
|
||||
// Force global redraw (in screen-coordinates)
|
||||
Wimp_ForceRedraw(-1, wind->vminx, wind->vmaxy, wind->vmaxx, wind->vmaxy + TitleBarHeight);
|
||||
}
|
||||
|
||||
|
||||
RO_Window *Window::Descriptor(void) {return(wind);}
|
||||
|
||||
|
||||
// Force a redraw on an icon (visible after the next Poll)
|
||||
void Window::ForceIconRedraw(unsigned int number)
|
||||
{
|
||||
if (number <= wind->icon_no)
|
||||
{
|
||||
register RO_Icon *ic;
|
||||
|
||||
ic = GetIcon(number);
|
||||
forceredraw(ic->minx, ic->miny, ic->maxx, ic->maxy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update an icon (visible immediately -- works only on purely WIMP-drawn icons!)
|
||||
void Window::UpdateIcon(unsigned int number)
|
||||
{
|
||||
if (number <= wind->icon_no)
|
||||
{
|
||||
register RO_Icon *ic;
|
||||
int Block[11]; // redraw block
|
||||
int more;
|
||||
|
||||
ic = GetIcon(number);
|
||||
Block[RedrawB_Handle] = wind->Handle;
|
||||
Block[RedrawB_VMinX] = ic->minx; Block[RedrawB_VMinY] = ic->miny;
|
||||
Block[RedrawB_VMaxX] = ic->maxx; Block[RedrawB_VMaxY] = ic->maxy;
|
||||
more = Wimp_UpdateWindow(Block); // standard redraw loop
|
||||
while (more != 0)
|
||||
{
|
||||
more = Wimp_GetRectangle(Block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// returns the current open-state of the window (true if open)
|
||||
bool Window::OpenStatus(void)
|
||||
{
|
||||
getstate();
|
||||
return(((wind->wflags & (1<<16)) == 0) ? false : true);
|
||||
}
|
||||
|
||||
|
||||
// Same as above, but reads the current state to Block
|
||||
bool Window::OpenStatus(int *Block)
|
||||
{
|
||||
getstate(Block);
|
||||
return(((Block[8] & (1<<16)) == 0) ? false : true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Icon member-functions - handle all things concerned with icons
|
||||
Icon::Icon(int Priority, const RO_IconDesc *IDesc)
|
||||
{
|
||||
memcpy((char*)&icon,(char*)IDesc,sizeof(RO_IconDesc));
|
||||
IHandle = Wimp_CreateIcon(Priority,IDesc);
|
||||
}
|
||||
|
||||
|
||||
Icon::~Icon(void)
|
||||
{
|
||||
int blk[2];
|
||||
|
||||
blk[0] = icon.WindowHandle; blk[1] = IHandle;
|
||||
Wimp_DeleteIcon((int*)blk);
|
||||
}
|
||||
|
||||
|
||||
void Icon::setstate(unsigned int eor, unsigned int clear)
|
||||
{
|
||||
int blk[4];
|
||||
|
||||
blk[0] = icon.WindowHandle; blk[1] = IHandle; blk[2] = eor; blk[3] = clear;
|
||||
Wimp_SetIconState((int*)blk);
|
||||
}
|
||||
|
||||
|
||||
void Icon::getstate(void)
|
||||
{
|
||||
int blk[10];
|
||||
|
||||
blk[0] = icon.WindowHandle; blk[1] = IHandle;
|
||||
Wimp_GetIconState((int*)blk);
|
||||
memcpy((char*)&icon,(int*)&blk[2],sizeof(RO_Icon));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Frodo member functions
|
||||
Frodo::Frodo(void) {TheC64 = NULL;}
|
||||
|
||||
|
||||
Frodo::~Frodo(void)
|
||||
{
|
||||
if (TheC64 != NULL) {delete TheC64;}
|
||||
}
|
||||
|
||||
|
||||
void Frodo::ReadyToRun(void)
|
||||
{
|
||||
ThePrefs.Load(DEFAULT_PREFS);
|
||||
TheC64 = new C64;
|
||||
load_rom_files();
|
||||
TheC64->Run();
|
||||
delete TheC64; TheC64 = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void (*__new_handler)(void);
|
||||
|
||||
// Out of memory
|
||||
void OutOfMemory(void)
|
||||
{
|
||||
_kernel_oserror err;
|
||||
|
||||
|
||||
err.errnum = 0; sprintf(err.errmess,"Out of memory error! Aborting.");
|
||||
Wimp_ReportError(&err,1,TASKNAME);
|
||||
delete the_app;
|
||||
Wimp_CloseDown(TaskHandle,TASK_WORD);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Frodo main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef __GNUG__
|
||||
// Switch off filename conversions in UnixLib:
|
||||
//__uname_control = __UNAME_NO_PROCESS;
|
||||
#endif
|
||||
|
||||
#ifdef FRODO_SC
|
||||
TaskHandle = Wimp_Initialise(310,TASK_WORD,"FrodoSC",(int*)WimpMessages);
|
||||
#else
|
||||
# ifdef FRODO_PC
|
||||
TaskHandle = Wimp_Initialise(310,TASK_WORD,"FrodoPC",(int*)WimpMessages);
|
||||
# else
|
||||
TaskHandle = Wimp_Initialise(310,TASK_WORD,"Frodo",(int*)WimpMessages);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Install handler for failed new
|
||||
__new_handler = OutOfMemory;
|
||||
|
||||
the_app = new Frodo();
|
||||
the_app->ReadyToRun();
|
||||
// Clean up directory scrap file
|
||||
DeleteFile(RO_TEMPFILE);
|
||||
delete the_app;
|
||||
Wimp_CloseDown(TaskHandle,TASK_WORD);
|
||||
return(0);
|
||||
}
|
177
Src/main_Amiga.h
177
Src/main_Amiga.h
@ -1,177 +0,0 @@
|
||||
/*
|
||||
* main_Amiga.h - Main program, AmigaOS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/execbase.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/intuition.h>
|
||||
|
||||
|
||||
// Global variables
|
||||
Frodo *be_app; // Pointer to Frodo object
|
||||
|
||||
// Library bases
|
||||
extern ExecBase *SysBase;
|
||||
struct GfxBase *GfxBase = NULL;
|
||||
struct IntuitionBase *IntuitionBase = NULL;
|
||||
struct Library *GadToolsBase = NULL;
|
||||
struct Library *DiskfontBase = NULL;
|
||||
struct Library *AslBase = NULL;
|
||||
|
||||
// Prototypes
|
||||
void error_exit(char *str);
|
||||
void open_libs(void);
|
||||
void close_libs(void);
|
||||
|
||||
|
||||
/*
|
||||
* Create application object and start it
|
||||
*/
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if ((SysBase->AttnFlags & (AFF_68040 | AFF_68881)) != (AFF_68040 | AFF_68881))
|
||||
error_exit("68040/68881 or higher required.\n");
|
||||
open_libs();
|
||||
|
||||
ULONG secs, micros;
|
||||
CurrentTime(&secs, µs);
|
||||
srand(micros);
|
||||
|
||||
be_app = new Frodo();
|
||||
be_app->ArgvReceived(argc, argv);
|
||||
be_app->ReadyToRun();
|
||||
delete be_app;
|
||||
|
||||
close_libs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Low-level failure
|
||||
*/
|
||||
|
||||
void error_exit(char *str)
|
||||
{
|
||||
printf(str);
|
||||
close_libs();
|
||||
exit(20);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open libraries
|
||||
*/
|
||||
|
||||
void open_libs(void)
|
||||
{
|
||||
if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 39)))
|
||||
error_exit("Couldn't open Gfx V39.\n");
|
||||
if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 39)))
|
||||
error_exit("Couldn't open Intuition V39.\n");
|
||||
if (!(GadToolsBase = OpenLibrary("gadtools.library", 39)))
|
||||
error_exit("Couldn't open GadTools V39.\n");
|
||||
if (!(DiskfontBase = OpenLibrary("diskfont.library", 39)))
|
||||
error_exit("Couldn't open Diskfont V39.\n");
|
||||
if (!(AslBase = OpenLibrary("asl.library", 39)))
|
||||
error_exit("Couldn't open ASL V39.\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close libraries
|
||||
*/
|
||||
|
||||
void close_libs(void)
|
||||
{
|
||||
if (AslBase)
|
||||
CloseLibrary(AslBase);
|
||||
if (DiskfontBase)
|
||||
CloseLibrary(DiskfontBase);
|
||||
if (GadToolsBase)
|
||||
CloseLibrary(GadToolsBase);
|
||||
if (IntuitionBase)
|
||||
CloseLibrary((struct Library *)IntuitionBase);
|
||||
if (GfxBase)
|
||||
CloseLibrary((struct Library *)GfxBase);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Constructor: Initialize member variables
|
||||
*/
|
||||
|
||||
Frodo::Frodo()
|
||||
{
|
||||
TheC64 = NULL;
|
||||
prefs_path[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process command line arguments
|
||||
*/
|
||||
|
||||
void Frodo::ArgvReceived(int argc, char **argv)
|
||||
{
|
||||
if (argc == 2)
|
||||
strncpy(prefs_path, argv[1], 255);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Arguments processed, run emulation
|
||||
*/
|
||||
|
||||
void Frodo::ReadyToRun(void)
|
||||
{
|
||||
getcwd(AppDirPath, 256);
|
||||
|
||||
// Load preferences
|
||||
if (!prefs_path[0])
|
||||
strcpy(prefs_path, "Frodo Prefs");
|
||||
ThePrefs.Load(prefs_path);
|
||||
|
||||
// Show preferences editor
|
||||
if (ThePrefs.ShowEditor(TRUE, prefs_path)) {
|
||||
|
||||
// Create and start C64
|
||||
TheC64 = new C64;
|
||||
load_rom_files();
|
||||
TheC64->Run();
|
||||
delete TheC64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Run preferences editor
|
||||
*/
|
||||
|
||||
void Frodo::RunPrefsEditor(void)
|
||||
{
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
if (prefs->ShowEditor(FALSE, prefs_path)) {
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
}
|
||||
delete prefs;
|
||||
}
|
401
Src/main_Be.h
401
Src/main_Be.h
@ -1,401 +0,0 @@
|
||||
/*
|
||||
* main_Be.h - Main program, BeOS specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <AppKit.h>
|
||||
#include <StorageKit.h>
|
||||
#include <Path.h>
|
||||
#include <InterfaceKit.h>
|
||||
|
||||
#include "Version.h"
|
||||
|
||||
|
||||
// Global variables
|
||||
bool FromShell;
|
||||
BEntry AppDirectory;
|
||||
BBitmap *AboutBitmap;
|
||||
const BRect AboutFrame = BRect(0, 0, 383, 99);
|
||||
|
||||
|
||||
/*
|
||||
* Create application object and start it
|
||||
*/
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Frodo *the_app;
|
||||
|
||||
srand(real_time_clock());
|
||||
FromShell = (argc != 0); // !! This doesn't work...
|
||||
|
||||
the_app = new Frodo();
|
||||
if (the_app != NULL) {
|
||||
the_app->Run();
|
||||
delete the_app;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Constructor: Initialize member variables
|
||||
*/
|
||||
|
||||
Frodo::Frodo() : BApplication(APP_SIGNATURE), this_messenger(this)
|
||||
{
|
||||
TheC64 = NULL;
|
||||
AboutBitmap = NULL;
|
||||
strcpy(prefs_path, "/boot/home/config/settings/Frodo_settings");
|
||||
prefs_showing = false;
|
||||
|
||||
// Create file panels
|
||||
open_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_OPEN_SNAPSHOT_RETURNED));
|
||||
open_panel->Window()->SetTitle("Frodo: Load snapshot");
|
||||
save_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_SAVE_SNAPSHOT_RETURNED));
|
||||
save_panel->Window()->SetTitle("Frodo: Save snapshot");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process command line arguments
|
||||
*/
|
||||
|
||||
void Frodo::ArgvReceived(int32 argc, char **argv)
|
||||
{
|
||||
if (argc == 2) {
|
||||
strncpy(prefs_path, argv[1], 1023);
|
||||
prefs_path[1023] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process Browser arguments
|
||||
*/
|
||||
|
||||
void Frodo::RefsReceived(BMessage *message)
|
||||
{
|
||||
// Set preferences path unless prefs editor is open or C64 is running
|
||||
if (!prefs_showing && !TheC64) {
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
|
||||
if (message->FindRef("refs", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR)
|
||||
if (the_entry.IsFile()) {
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(prefs_path, the_path.Path(), 1023);
|
||||
prefs_path[1023] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Arguments processed, prepare emulation and show preferences editor window
|
||||
*/
|
||||
|
||||
void Frodo::ReadyToRun(void)
|
||||
{
|
||||
// Find application directory and cwd to it
|
||||
app_info the_info;
|
||||
GetAppInfo(&the_info);
|
||||
BEntry the_file(&the_info.ref);
|
||||
the_file.GetParent(&AppDirectory);
|
||||
BPath the_path;
|
||||
AppDirectory.GetPath(&the_path);
|
||||
strncpy(AppDirPath, the_path.Path(), 1023);
|
||||
AppDirPath[1023] = 0;
|
||||
chdir(AppDirPath);
|
||||
|
||||
// Set up "about" window bitmap
|
||||
AboutBitmap = new BBitmap(AboutFrame, B_COLOR_8_BIT);
|
||||
FILE *logofile = fopen("Frodo Logo", "rb");
|
||||
if (logofile != NULL) {
|
||||
fread(AboutBitmap->Bits(), 384*100, 1, logofile);
|
||||
fclose(logofile);
|
||||
}
|
||||
|
||||
// Load preferences
|
||||
ThePrefs.Load(prefs_path);
|
||||
|
||||
// Show preferences editor (sends MSG_STARTUP on close)
|
||||
prefs_showing = true;
|
||||
ThePrefs.ShowEditor(true, prefs_path);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle incoming messages
|
||||
*/
|
||||
|
||||
void Frodo::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch (msg->what) {
|
||||
case MSG_STARTUP: // Start the emulation
|
||||
|
||||
// Preferences editor is not longer on screen
|
||||
prefs_showing = false;
|
||||
|
||||
// Create everything
|
||||
TheC64 = new C64;
|
||||
|
||||
// Load ROMs
|
||||
load_rom_files();
|
||||
|
||||
// Run the 6510
|
||||
TheC64->Run();
|
||||
break;
|
||||
|
||||
case MSG_PREFS: // Show preferences editor
|
||||
if (TheC64 != NULL && !prefs_showing) {
|
||||
TheC64->Pause();
|
||||
TheC64->TheDisplay->Pause();
|
||||
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
prefs_showing = true;
|
||||
prefs->ShowEditor(false, prefs_path); // Sends MSG_PREFS_DONE on close
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_PREFS_DONE: { // Preferences editor closed
|
||||
Prefs *prefs;
|
||||
msg->FindPointer("prefs", (void **)&prefs);
|
||||
if (!msg->FindBool("canceled")) {
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
}
|
||||
delete prefs;
|
||||
prefs_showing = false;
|
||||
|
||||
TheC64->TheDisplay->Resume();
|
||||
TheC64->Resume();
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_RESET: // Reset C64
|
||||
if (TheC64 != NULL)
|
||||
TheC64->Reset();
|
||||
break;
|
||||
|
||||
case MSG_NMI: // NMI
|
||||
if (TheC64 != NULL)
|
||||
TheC64->NMI();
|
||||
break;
|
||||
|
||||
case MSG_SAM: // Invoke SAM
|
||||
if (TheC64 != NULL && !prefs_showing && FromShell) {
|
||||
TheC64->Pause();
|
||||
TheC64->TheDisplay->Pause();
|
||||
SAM(TheC64);
|
||||
TheC64->TheDisplay->Resume();
|
||||
TheC64->Resume();
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_NEXTDISK: // Insert next disk in drive 8
|
||||
if (TheC64 != NULL && !prefs_showing && strlen(ThePrefs.DrivePath[0]) > 4) {
|
||||
char str[256];
|
||||
strcpy(str, ThePrefs.DrivePath[0]);
|
||||
char *p = str + strlen(str) - 5;
|
||||
|
||||
// If path matches "*.?64", increment character before the '.'
|
||||
if (p[1] == '.' && p[3] == '6' && p[4] == '4') {
|
||||
p[0]++;
|
||||
|
||||
// If no such file exists, set character before the '.' to '1', 'a' or 'A'
|
||||
FILE *file;
|
||||
if ((file = fopen(str, "rb")) == NULL) {
|
||||
if (isdigit(p[0]))
|
||||
p[0] = '1';
|
||||
else if (isupper(p[0]))
|
||||
p[0] = 'A';
|
||||
else
|
||||
p[0] = 'a';
|
||||
} else
|
||||
fclose(file);
|
||||
|
||||
// Set new prefs
|
||||
TheC64->Pause();
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
strcpy(prefs->DrivePath[0], str);
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
delete prefs;
|
||||
TheC64->Resume();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_TOGGLE_1541: // Toggle processor-level 1541 emulation
|
||||
if (TheC64 != NULL && !prefs_showing) {
|
||||
TheC64->Pause();
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
prefs->Emul1541Proc = !prefs->Emul1541Proc;
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
delete prefs;
|
||||
TheC64->Resume();
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_OPEN_SNAPSHOT:
|
||||
if (TheC64 != NULL && !prefs_showing)
|
||||
open_panel->Show();
|
||||
break;
|
||||
|
||||
case MSG_SAVE_SNAPSHOT:
|
||||
if (TheC64 != NULL && !prefs_showing)
|
||||
save_panel->Show();
|
||||
break;
|
||||
|
||||
case MSG_OPEN_SNAPSHOT_RETURNED:
|
||||
if (TheC64 != NULL && !prefs_showing) {
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR)
|
||||
if (the_entry.IsFile()) {
|
||||
char path[1024];
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(path, the_path.Path(), 1023);
|
||||
path[1023] = 0;
|
||||
TheC64->Pause();
|
||||
TheC64->LoadSnapshot(path);
|
||||
TheC64->Resume();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_SAVE_SNAPSHOT_RETURNED:
|
||||
if (TheC64 != NULL && !prefs_showing) {
|
||||
entry_ref the_ref;
|
||||
BEntry the_entry;
|
||||
if (msg->FindRef("directory", &the_ref) == B_NO_ERROR)
|
||||
if (the_entry.SetTo(&the_ref) == B_NO_ERROR) {
|
||||
char path[1024];
|
||||
BPath the_path;
|
||||
the_entry.GetPath(&the_path);
|
||||
strncpy(path, the_path.Path(), 1023);
|
||||
strncat(path, "/", 1023);
|
||||
strncat(path, msg->FindString("name"), 1023);
|
||||
path[1023] = 0;
|
||||
TheC64->Pause();
|
||||
TheC64->SaveSnapshot(path);
|
||||
TheC64->Resume();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
BApplication::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Quit requested (either by menu or by closing the C64 display window)
|
||||
*/
|
||||
|
||||
bool Frodo::QuitRequested(void)
|
||||
{
|
||||
// Stop emulation
|
||||
if (TheC64) {
|
||||
TheC64->Quit();
|
||||
delete TheC64;
|
||||
}
|
||||
|
||||
delete AboutBitmap;
|
||||
delete open_panel;
|
||||
delete save_panel;
|
||||
|
||||
return BApplication::QuitRequested();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display "about" window
|
||||
*/
|
||||
|
||||
class AboutView : public BView {
|
||||
public:
|
||||
AboutView() : BView(AboutFrame, "", B_FOLLOW_NONE, B_WILL_DRAW) {}
|
||||
|
||||
virtual void AttachedToWindow(void)
|
||||
{
|
||||
SetHighColor(0, 0, 0);
|
||||
}
|
||||
|
||||
virtual void Draw(BRect update)
|
||||
{
|
||||
DrawBitmap(AboutBitmap, update, update);
|
||||
|
||||
SetFont(be_bold_font);
|
||||
SetDrawingMode(B_OP_OVER);
|
||||
MovePenTo(204, 20);
|
||||
DrawString(VERSION_STRING);
|
||||
|
||||
SetFont(be_plain_font);
|
||||
MovePenTo(204, 40);
|
||||
DrawString("by Christian Bauer");
|
||||
MovePenTo(204, 52);
|
||||
DrawString("<Christian.Bauer@uni-mainz.de>");
|
||||
MovePenTo(204, 75);
|
||||
DrawString(B_UTF8_COPYRIGHT " Copyright 1994-1997,2002-2005");
|
||||
MovePenTo(204, 87);
|
||||
DrawString("Freely distributable.");
|
||||
}
|
||||
|
||||
virtual void MouseDown(BPoint point)
|
||||
{
|
||||
Window()->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
};
|
||||
|
||||
class AboutWindow : public BWindow {
|
||||
public:
|
||||
AboutWindow() : BWindow(AboutFrame, NULL, B_BORDERED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK)
|
||||
{
|
||||
Lock();
|
||||
MoveTo(100, 100);
|
||||
AboutView *view = new AboutView;
|
||||
AddChild(view);
|
||||
view->MakeFocus();
|
||||
Unlock();
|
||||
Show();
|
||||
}
|
||||
};
|
||||
|
||||
void Frodo::AboutRequested(void)
|
||||
{
|
||||
new AboutWindow();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Determine whether path name refers to a directory
|
||||
*/
|
||||
|
||||
bool IsDirectory(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
return stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode);
|
||||
}
|
126
Src/main_WIN32.h
126
Src/main_WIN32.h
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* main_WIN32.h - Main program, WIN32 specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// The application.
|
||||
Frodo *TheApp;
|
||||
|
||||
// WinMain args.
|
||||
HINSTANCE hInstance;
|
||||
int nCmdShow;
|
||||
HWND hwnd;
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance_arg, HINSTANCE /* hPrevInstance */, LPSTR lpCmdLine, int nCmdShow_arg)
|
||||
{
|
||||
hInstance = hInstance_arg;
|
||||
nCmdShow = nCmdShow_arg;
|
||||
TheApp = new Frodo();
|
||||
TheApp->ArgvReceived(__argc, __argv);
|
||||
TheApp->ReadyToRun();
|
||||
delete TheApp;
|
||||
DestroyWindow(hwnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor: Initialize member variables
|
||||
*/
|
||||
|
||||
Frodo::Frodo()
|
||||
{
|
||||
TheC64 = NULL;
|
||||
prefs_path[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
Frodo::~Frodo()
|
||||
{
|
||||
delete TheC64;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process command line arguments
|
||||
*/
|
||||
|
||||
void Frodo::ArgvReceived(int argc, char **argv)
|
||||
{
|
||||
char *progname = argv[0];
|
||||
argc--, argv++;
|
||||
if (argc >= 1 && argv[0][0] != '\0') {
|
||||
|
||||
// XXX: This should be a function.
|
||||
char cwd[256];
|
||||
GetCurrentDirectory(sizeof(cwd), cwd);
|
||||
int cwd_len = strlen(cwd);
|
||||
if (cwd_len > 0 && cwd[cwd_len - 1] != '\\') {
|
||||
strcat(cwd, "\\");
|
||||
cwd_len++;
|
||||
}
|
||||
if (strnicmp(argv[0], cwd, cwd_len) == 0)
|
||||
strncpy(prefs_path, argv[0] + cwd_len, 255);
|
||||
else
|
||||
strncpy(prefs_path, argv[0], 255);
|
||||
int length = strlen(prefs_path);
|
||||
if (length > 4 && strchr(prefs_path, '.') == NULL)
|
||||
strcat(prefs_path, ".fpr");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Arguments processed, run emulation
|
||||
*/
|
||||
|
||||
void Frodo::ReadyToRun(void)
|
||||
{
|
||||
getcwd(AppDirPath, 256);
|
||||
|
||||
// Load preferences
|
||||
if (!prefs_path[0])
|
||||
strcpy(prefs_path, "Frodo.fpr");
|
||||
ThePrefs.Load(prefs_path);
|
||||
|
||||
if (ThePrefs.PrefsAtStartup) {
|
||||
if (!ThePrefs.ShowEditor(TRUE, prefs_path))
|
||||
return;
|
||||
}
|
||||
|
||||
// Create and start C64
|
||||
TheC64 = new C64;
|
||||
load_rom_files();
|
||||
TheC64->Run();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Run preferences editor
|
||||
*/
|
||||
|
||||
void Frodo::RunPrefsEditor(void)
|
||||
{
|
||||
Prefs *prefs = new Prefs(ThePrefs);
|
||||
if (prefs->ShowEditor(FALSE, prefs_path)) {
|
||||
TheC64->NewPrefs(prefs);
|
||||
ThePrefs = *prefs;
|
||||
}
|
||||
delete prefs;
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case "${1}" in
|
||||
-h | --help | --h* ) # -h for help
|
||||
echo "${usage}" 1>&2; exit 0 ;;
|
||||
-m ) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||
dirmode="${1}"
|
||||
shift ;;
|
||||
-- ) shift; break ;; # stop option processing
|
||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||
* ) break ;; # first non-opt arg
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi ;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 3
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
1476
Src/sdlgui.cpp
1476
Src/sdlgui.cpp
File diff suppressed because it is too large
Load Diff
83
Src/sdlgui.h
83
Src/sdlgui.h
@ -1,83 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* This file is taken from the ARAnyM project which builds a new and powerful
|
||||
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
|
||||
*
|
||||
* This file is distributed under the GNU Public License, version 2 or at
|
||||
* your option any later version. Read the file gpl.txt for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SDLGUI_H
|
||||
#define _SDLGUI_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
enum
|
||||
{
|
||||
SGBOX,
|
||||
SGTEXT,
|
||||
SGEDITFIELD,
|
||||
SGBUTTON,
|
||||
SGCHECKBOX,
|
||||
SGPOPUP
|
||||
};
|
||||
|
||||
|
||||
/* Object flags: */
|
||||
#define SG_TOUCHEXIT 1
|
||||
#define SG_EXIT 2
|
||||
#define SG_BUTTON_RIGHT 4
|
||||
#define SG_DEFAULT 8
|
||||
#define SG_SELECTABLE 16
|
||||
#define SG_BACKGROUND 32
|
||||
#define SG_RADIO 64
|
||||
|
||||
/* Object states: */
|
||||
#define SG_SELECTED 1
|
||||
#define SG_HIDDEN 2
|
||||
#define SG_DISABLED 4
|
||||
|
||||
/* Special characters: */
|
||||
#define SGCHECKBOX_RADIO_NORMAL 12
|
||||
#define SGCHECKBOX_RADIO_SELECTED 13
|
||||
#define SGCHECKBOX_NORMAL 14
|
||||
#define SGCHECKBOX_SELECTED 15
|
||||
#define SGARROWUP 1
|
||||
#define SGARROWDOWN 2
|
||||
#define SGFOLDER 5
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int type; /* What type of object */
|
||||
int flags; /* Object flags */
|
||||
int state; /* Object state */
|
||||
int x, y; /* The offset to the upper left corner */
|
||||
unsigned int w, h; /* Width and height */
|
||||
char *txt; /* Text string */
|
||||
} SGOBJ;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int object;
|
||||
int position;
|
||||
int blink_counter;
|
||||
bool blink_state;
|
||||
} cursor_state;
|
||||
|
||||
extern void screenlock();
|
||||
extern void screenunlock();
|
||||
|
||||
bool SDLGui_Init(SDL_Surface *GUISurface);
|
||||
int SDLGui_UnInit(void);
|
||||
int SDLGui_DoDialog(SGOBJ *dlg);
|
||||
int SDLGui_PrepareFont(void);
|
||||
void SDLGui_FreeFont(void);
|
||||
|
||||
SDL_Rect *SDLGui_GetFirstBackgroundRect(void);
|
||||
SDL_Rect *SDLGui_GetNextBackgroundRect(void);
|
||||
|
||||
SDL_Event getEvent(SGOBJ *dlg, cursor_state *cursor);
|
||||
|
||||
#endif /* _SDLGUI_H */
|
@ -1,6 +0,0 @@
|
||||
export PATH=$PATH:/opt/Embedix/tools/bin/
|
||||
export CXX=arm-linux-g++
|
||||
export CC=arm-linux-gcc
|
||||
export LD=arm-linux-ld
|
||||
export LDFLAGS="-L/opt/Qtopia/sharp/lib/ -L/opt/Embedix/tools/arm-linux/lib"
|
||||
export CPPFLAGS="-DQTOPIA"
|
@ -1,144 +0,0 @@
|
||||
/* Src/sysconfig.h for Acorn RISC OS */
|
||||
|
||||
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
/* #undef HAVE_ST_BLOCKS */
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
/*#define HAVE_UTIME_NULL 1 */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/*#define TIME_WITH_SYS_TIME 1*/
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#define SIZEOF_CHAR 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
/* #undef SIZEOF_LONG_LONG */
|
||||
|
||||
/* The number of bytes in a short. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
/*#define HAVE_GETTIMEOFDAY 1*/
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
/*#define HAVE_MKDIR 1*/
|
||||
|
||||
/* Define if you have the rmdir function. */
|
||||
/*#define HAVE_RMDIR 1*/
|
||||
|
||||
/* Define if you have the select function. */
|
||||
/*#define HAVE_SELECT 1*/
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
/*#define HAVE_SIGACTION 1*/
|
||||
|
||||
/* Define if you have the signal function */
|
||||
#define HAVE_SIGNAL
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
/* #undef HAVE_STATFS */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
/*#define HAVE_DIRENT_H 1*/
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
/*#define HAVE_FCNTL_H 1*/
|
||||
|
||||
/* Define if you have the <linux/joystick.h> header file. */
|
||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
/*#define HAVE_SYS_DIR_H 1*/
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
/* #undef HAVE_SYS_MOUNT_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/*#define HAVE_SYS_PARAM_H 1*/
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
/*#define HAVE_SYS_STAT_H 1*/
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATFS_H */
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATVFS_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
/*#define HAVE_SYS_TIME_H 1*/
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
/*#define HAVE_SYS_TYPES_H 1*/
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
/* #undef HAVE_SYS_VFS_H */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
/*#define HAVE_UNISTD_H 1*/
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
/*#define HAVE_UTIME_H 1*/
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
@ -1,143 +0,0 @@
|
||||
/* Src/sysconfig.h for AmigaOS */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
#define HAVE_ST_BLOCKS 1
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#define HAVE_UTIME_NULL 1
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#define SIZEOF_CHAR 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The number of bytes in a short. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define if you have the rmdir function. */
|
||||
#define HAVE_RMDIR 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#define HAVE_SIGACTION 1
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
/* #undef HAVE_STATFS */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <linux/joystick.h> header file. */
|
||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#define HAVE_NDIR_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#define HAVE_SYS_DIR_H 1
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
/* #undef HAVE_SYS_MOUNT_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATFS_H */
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATVFS_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
/* #undef HAVE_SYS_VFS_H */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
@ -1,143 +0,0 @@
|
||||
/* Src/sysconfig.h for BeOS */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
/* #undef HAVE_ST_BLOCKS */
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#define HAVE_UTIME_NULL 1
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#define SIZEOF_CHAR 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The number of bytes in a short. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define if you have the rmdir function. */
|
||||
#define HAVE_RMDIR 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#define HAVE_SIGACTION 1
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
/* #undef HAVE_STATFS */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <linux/joystick.h> header file. */
|
||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#define HAVE_SYS_DIR_H 1
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
/* #undef HAVE_SYS_MOUNT_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATFS_H */
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATVFS_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
/* #undef HAVE_SYS_VFS_H */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
@ -1,143 +0,0 @@
|
||||
/* Src/sysconfig.h for AmigaOS */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
/* #define HAVE_ST_BLOCKS 1 */
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#define HAVE_UTIME_NULL 1
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define mode_t int
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define pid_t int
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/* #undef TIME_WITH_SYS_TIME */
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#define SIZEOF_CHAR 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The number of bytes in a short. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define if you have the rmdir function. */
|
||||
#define HAVE_RMDIR 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
/* #undef HAVE_SIGACTION */
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
/* #undef HAVE_STATFS */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
/* #undef HAVE_DIRENT_H */
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <linux/joystick.h> header file. */
|
||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#define HAVE_NDIR_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
/* #define HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
/* #undef HAVE_SYS_MOUNT_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/* #undef HAVE_SYS_PARAM_H */
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATFS_H */
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATVFS_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
/* #undef HAVE_SYS_TIME_H */
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
/* #undef HAVE_SYS_VFS_H */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
/* #undef HAVE_UNISTD_H */
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
/* #undef HAVE_UTIME_H */
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
Loading…
Reference in New Issue
Block a user