/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: sdl_mapper.cpp,v 1.60 2009-06-01 10:25:51 qbix79 Exp $ */
#include <vector>
#include <list>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include "SDL.h"
#include "SDL_thread.h"
#include "dosbox.h"
#include "video.h"
#include "keyboard.h"
#include "joystick.h"
#include "support.h"
#include "mapper.h"
#include "setup.h"
enum {
CLR_BLACK=0,
CLR_WHITE=1,
CLR_RED=2,
CLR_BLUE=3,
CLR_GREEN=4
};
enum BB_Types {
BB_Next,BB_Add,BB_Del,
BB_Save,BB_Exit
};
enum BC_Types {
BC_Mod1,BC_Mod2,BC_Mod3,
BC_Hold
};
#define BMOD_Mod1 0x0001
#define BMOD_Mod2 0x0002
#define BMOD_Mod3 0x0004
#define BFLG_Hold 0x0001
#define BFLG_Repeat 0x0004
#define MAXSTICKS 8
#define MAXACTIVE 16
#define MAXBUTTON 32
#define MAXBUTTON_CAP 16
class CEvent;
class CHandlerEvent;
class CButton;
class CBind;
class CBindGroup;
static void SetActiveEvent(CEvent * event);
static void SetActiveBind(CBind * _bind);
extern Bit8u int10_font_14[256 * 14];
static std::vector<CEvent *> events;
static std::vector<CButton *> buttons;
static std::vector<CBindGroup *> bindgroups;
static std::vector<CHandlerEvent *> handlergroup;
typedef std::list<CBind *> CBindList;
typedef std::list<CEvent *>::iterator CEventList_it;
typedef std::list<CBind *>::iterator CBindList_it;
typedef std::vector<CButton *>::iterator CButton_it;
typedef std::vector<CEvent *>::iterator CEventVector_it;
typedef std::vector<CHandlerEvent *>::iterator CHandlerEventVector_it;
typedef std::vector<CBindGroup *>::iterator CBindGroup_it;
static CBindList holdlist;
class CEvent {
public:
CEvent(char const * const _entry) {
safe_strncpy(entry,_entry,16);
events.push_back(this);
bindlist.clear();
activity=0;
current_value=0;
}
void AddBind(CBind * bind);
virtual ~CEvent() {}
virtual void Active(bool yesno)=0;
virtual void ActivateEvent(bool ev_trigger,bool skip_action)=0;
virtual void DeActivateEvent(bool ev_trigger)=0;
void DeActivateAll(void);
void SetValue(Bits value){
current_value=value;
}
Bits GetValue(void) {
return current_value;
}
char * GetName(void) { return entry; }
virtual bool IsTrigger(void)=0;
CBindList bindlist;
protected:
Bitu activity;
char entry[16];
Bits current_value;
};
/* class for events which can be ON/OFF only: key presses, joystick buttons, joystick hat */
class CTriggeredEvent : public CEvent {
public:
CTriggeredEvent(char const * const _entry) : CEvent(_entry) {}
virtual bool IsTrigger(void) {
return true;
}
void ActivateEvent(bool ev_trigger,bool skip_action) {
if (current_value>25000) {
/* value exceeds boundary, trigger event if not active */
if (!activity && !skip_action) Active(true);
if (activity<32767) activity++;
} else {
if (activity>0) {
/* untrigger event if it is fully inactive */
DeActivateEvent(ev_trigger);
activity=0;
}
}
}
void DeActivateEvent(bool /*ev_trigger*/) {
activity--;
if (!activity) Active(false);
}
};
/* class for events which have a non-boolean state: joystick axis movement */
class CContinuousEvent : public CEvent {
public:
CContinuousEvent(char const * const _entry) : CEvent(_entry) {}
virtual bool IsTrigger(void) {
return false;
}
void ActivateEvent(bool ev_trigger,bool skip_action) {
if (ev_trigger) {
activity++;
if (!skip_action) Active(true);
} else {
/* test if no trigger-activity is present, this cares especially
about activity of the opposite-direction joystick axis for example */
if (!GetActivityCount()) Active(true);
}
}
void DeActivateEvent(bool ev_trigger) {
if (ev_trigger) {
if (activity>0) activity--;
if (activity==0) {
/* test if still some trigger-activity is present,
adjust the state in this case accordingly */
if (GetActivityCount()) RepostActivity();
else Active(false);
}
} else {
if (!GetActivityCount()) Active(false);
}
}
virtual Bitu GetActivityCount(void) {
return activity;
}
virtual void RepostActivity(void) {}
};
class CBind {
public:
virtual ~CBind () {
list->remove(this);
// event->bindlist.remove(this);
}
CBind(CBindList * _list) {
list=_list;
_list->push_back(this);
mods=flags=0;
event=0;
active=holding=false;
}
void AddFlags(char * buf) {
if (mods & BMOD_Mod1) strcat(buf," mod1");
if (mods & BMOD_Mod2) strcat(buf," mod2");
if (mods & BMOD_Mod3) strcat(buf," mod3");
if (flags & BFLG_Hold) strcat(buf," hold");
}
void SetFlags(char * buf) {
char * word;
while (*(word=StripWord(buf))) {
if (!strcasecmp(word,"mod1")) mods|=BMOD_Mod1;
if (!strcasecmp(word,"mod2")) mods|=BMOD_Mod2;
if (!strcasecmp(word,"mod3")) mods|=BMOD_Mod3;
if (!strcasecmp(word,"hold")) flags|=BFLG_Hold;
}
}
void ActivateBind(Bits _value,bool ev_trigger,bool skip_action=false) {
if (event->IsTrigger()) {
/* use value-boundary for on/off events */
if (_value>25000) {
event->SetValue(_value);
if (active) return;
event->ActivateEvent(ev_trigger,skip_action);
active=true;
} else {
if (active) {
event->DeActivateEvent(ev_trigger);
active=false;
}
}
} else {
/* store value for possible later use in the activated event */
event->SetValue(_value);
event->ActivateEvent(ev_trigger,false);
}
}
void DeActivateBind(bool ev_trigger) {
if (event->IsTrigger()) {
if (!active) return;
active=false;
if (flags & BFLG_Hold) {
if (!holding) {
holdlist.push_back(this);
holding=true;
return;
} else {
holdlist.remove(this);
holding=false;
}
}
event->DeActivateEvent(ev_trigger);
} else {
/* store value for possible later use in the activated event */
event->SetValue(0);
event->DeActivateEvent(ev_trigger);
}
}
virtual void ConfigName(char * buf)=0;
virtual void BindName(char * buf)=0;
Bitu mods,flags;
Bit16s value;
CEvent * event;
CBindList * list;
bool active,holding;
};
void CEvent::AddBind(CBind * bind) {
bindlist.push_front(bind);
bind->event=this;
}
void CEvent::DeActivateAll(void) {
for (CBindList_it bit=bindlist.begin();bit!=bindlist.end();bit++) {
(*bit)->DeActivateBind(true);
}
}
class CBindGroup {
public:
CBindGroup() {
bindgroups.push_back(this);
}
void ActivateBindList(CBindList * list,Bits value,bool ev_trigger);
void DeactivateBindList(CBindList * list,bool ev_trigger);
virtual CBind * CreateConfigBind(char *&buf)=0;
virtual CBind * CreateEventBind(SDL_Event * event)=0;
virtual bool CheckEvent(SDL_Event * event)=0;
virtual const char * ConfigStart(void)=0;
virtual const char * BindStart(void)=0;
virtual ~CBindGroup (void) { }
protected:
};
#define MAX_SDLKEYS 323
static bool usescancodes;
static Bit8u scancode_map[MAX_SDLKEYS];
#define Z SDLK_UNKNOWN
#if defined (MACOSX)
static SDLKey sdlkey_map[]={
/* Main block printables */
/*00-05*/ SDLK_a, SDLK_s, SDLK_d, SDLK_f, SDLK_h, SDLK_g,
/*06-0B*/ SDLK_z, SDLK_x, SDLK_c, SDLK_v, SDLK_WORLD_0, SDLK_b,
/*0C-11*/ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_y, SDLK_t,
/*12-17*/ SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_6, SDLK_5,
/*18-1D*/ SDLK_EQUALS, SDLK_9, SDLK_7, SDLK_MINUS, SDLK_8, SDLK_0,
/*1E-21*/ SDLK_RIGHTBRACKET, SDLK_o, SDLK_u, S
没有合适的资源?快使用搜索试试~ 我知道了~
dosbox-0.74 无bug修复版(内含.EXE文件)
5星 · 超过95%的资源 需积分: 42 56 下载量 87 浏览量
2016-10-25
13:37:05
上传
评论 3
收藏 1.69MB GZ 举报
温馨提示
共468个文件
h:122个
cpp:117个
po:115个
这是修复bug的dosbox-0.74,RedHat系列用户需要安装的可以直接安装,并且内含DEBUG.EXE,LINK.EXE,MASM.EXE。
资源推荐
资源详情
资源评论
收起资源包目录
dosbox-0.74 无bug修复版(内含.EXE文件) (468个子文件)
output.0 252KB
traces.0 59KB
output.1 252KB
traces.1 54KB
dosbox.1 12KB
output.2 252KB
traces.2 59KB
output.3 252KB
traces.3 54KB
configure.ac 17KB
Makefile.am 625B
Makefile.am 623B
Makefile.am 515B
Makefile.am 442B
Makefile.am 421B
Makefile.am 398B
Makefile.am 348B
Makefile.am 341B
Makefile.am 306B
Makefile.am 174B
Makefile.am 157B
Makefile.am 146B
Makefile.am 146B
Makefile.am 115B
Makefile.am 112B
Makefile.am 106B
Makefile.am 99B
Makefile.am 95B
Makefile.am 91B
Makefile.am 61B
Makefile.am 53B
Makefile.am 46B
Makefile.am 37B
Makefile.am 29B
AUTHORS 264B
ChangeLog 30KB
configure 250KB
COPYING 18KB
sdl_mapper.cpp 75KB
debug.cpp 71KB
cpu.cpp 68KB
int10_memory.cpp 68KB
int10_modes.cpp 58KB
sdlmain.cpp 56KB
dos_programs.cpp 51KB
vga_draw.cpp 48KB
int10_vptable.cpp 46KB
ems.cpp 46KB
opl.cpp 46KB
sblaster.cpp 46KB
gui_tk.cpp 44KB
dos_mscdex.cpp 40KB
dos_keyboard_layout.cpp 40KB
dbopl.cpp 39KB
drive_fat.cpp 36KB
dos_files.cpp 35KB
vga_xga.cpp 34KB
ipx.cpp 34KB
bios.cpp 33KB
serialport.cpp 33KB
dos.cpp 33KB
debug_disasm.cpp 33KB
shell_cmds.cpp 31KB
mouse.cpp 30KB
vga_memory.cpp 28KB
setup.cpp 26KB
dosbox.cpp 26KB
paging.cpp 25KB
shell.cpp 25KB
gus.cpp 25KB
hardware.cpp 24KB
vga_tseng.cpp 24KB
flags.cpp 24KB
int10.cpp 23KB
callback.cpp 23KB
cdrom_aspi_win32.cpp 23KB
drive_cache.cpp 22KB
sdl_gui.cpp 21KB
bios_keyboard.cpp 20KB
vga_s3.cpp 20KB
vga_other.cpp 20KB
render.cpp 20KB
softmodem.cpp 19KB
int10_char.cpp 19KB
mixer.cpp 19KB
cdrom_image.cpp 19KB
libserial.cpp 18KB
adlib.cpp 18KB
mpu401.cpp 18KB
drive_local.cpp 17KB
cdrom_ioctl_win32.cpp 17KB
shell_misc.cpp 17KB
pic.cpp 16KB
nullmodem.cpp 16KB
dos_execute.cpp 16KB
drive_iso.cpp 16KB
int10_vesa.cpp 15KB
memory.cpp 15KB
gameblaster.cpp 15KB
vga_crtc.cpp 15KB
共 468 条
- 1
- 2
- 3
- 4
- 5
杨博东的博客
- 粉丝: 499
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python实现MLP时间序列预测(完整源码和数据)
- 已过基于Hadoop+Spark招聘推荐可视化系统 大数据项目 毕业设计(源码下载)
- python爬虫开发题答案及题目-100(1).zip
- Python 小游戏 (贪吃蛇、五子棋、扫雷、俄罗斯方块)-3 (2).zip
- c语言实现的数独小游戏.zip
- 高德地图中国行政区划省、市、县经纬度
- March 2024 Expiration Of The OAM Out Of The Box Certificates
- 二叉搜索树迭代器(java代码).docx
- 解决keil MDK 5.38版本 在Debug配置使用STlink调试时软件闪退的问题
- py小项目:用户登录和注册系统开发欢迎图片
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页