Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
### Eclipse Workspace Patch 1.0
#P dosbox
Index: include/pinhacks.h
===================================================================
--- include/pinhacks.h (nonexistent)
+++ include/pinhacks.h (working copy)
@@ -0,0 +1,24 @@
+/*
+ * Copyleft:
+ * This file was made to be used with DOSBOX, and so
+ * is under GNU general public license
+ */
+
+#ifndef __DOSBOX_PINHACK_H
+#define __DOSBOX_PINHACK_H
+#define PINHACKVERSION 3
+
+extern struct scrollhack {
+ bool enabled,trigger;
+ struct {
+ int min, max;
+ }triggerwidth,triggerheight;
+ struct {int height, width;} expand;
+ struct {struct { bool enabled,trigger;}
+ psychopinball,
+ pinballdreams;
+ }specifichack;
+ const char * doublewidth;
+}pinhack ;
+
+#endif /* __DOSBOX_PINHACK_H */
Index: src/hardware/vga_crtc.cpp
===================================================================
--- src/hardware/vga_crtc.cpp (revision 4258)
+++ src/hardware/vga_crtc.cpp (working copy)
@@ -25,6 +25,7 @@
#include "cpu.h"
#include "video.h"
#include "pic.h"
+#include "pinhacks.h"
#define crtc(blah) vga.crtc.blah
@@ -190,11 +191,13 @@
*/
break;
case 0x0C: /* Start Address High Register */
+if (pinhack.trigger) val=0;
crtc(start_address_high)=val;
vga.config.display_start=(vga.config.display_start & 0xFF00FF)| (val << 8);
/* 0-7 Upper 8 bits of the start address of the display buffer */
break;
case 0x0D: /* Start Address Low Register */
+if (pinhack.trigger) val=0;
crtc(start_address_low)=val;
vga.config.display_start=(vga.config.display_start & 0xFFFF00)| val;
/* 0-7 Lower 8 bits of the start address of the display buffer */
Index: src/hardware/vga_draw.cpp
===================================================================
--- src/hardware/vga_draw.cpp (revision 4258)
+++ src/hardware/vga_draw.cpp (working copy)
@@ -25,6 +25,8 @@
#include "../gui/render_scalers.h"
#include "vga.h"
#include "pic.h"
+#include "pinhacks.h"
+#include <cstdio>
//#undef C_DEBUG
//#define C_DEBUG 1
@@ -720,6 +722,7 @@
vga.draw.address+=vga.draw.address_add;
}
vga.draw.lines_done++;
+ if (pinhack.trigger == false) {
if (vga.draw.split_line==vga.draw.lines_done) {
#ifdef VGA_KEEP_CHANGES
VGA_ChangesEnd( );
@@ -728,6 +731,7 @@
#ifdef VGA_KEEP_CHANGES
vga.changes.start = vga.draw.address >> VGA_CHANGE_SHIFT;
#endif
+ }
}
}
if (--vga.draw.parts_left) {
@@ -1529,6 +1533,25 @@
height/=2;
}
}
+ if (pinhack.enabled) { // Enabled in config?
+ printf("PINHACK: "); // Check for tirggering preconditions...
+ if ( ( !pinhack.specifichack.pinballdreams.enabled || pinhack.specifichack.pinballdreams.trigger ) &&
+ ( height>=pinhack.triggerheight.min && height<=pinhack.triggerheight.max ) &&
+ ( pinhack.triggerwidth.min<=width && width<=pinhack.triggerwidth.max ) ) {
+ printf("triggered -> ");
+ pinhack.trigger = true;
+ printf("original geometry: %dx%d. expanding to geometry: %dx%d.\n",width,height,
+ pinhack.expand.width ? pinhack.expand.width : width,
+ pinhack.expand.height ? pinhack.expand.height : height);
+ // If width or height not set, do not expand!
+ if ( pinhack.expand.height ) height = pinhack.expand.height;
+ if ( pinhack.expand.width ) width = pinhack.expand.width;
+ if ( pinhack.specifichack.pinballdreams.trigger ) pinhack.specifichack.pinballdreams.trigger=false; // On next resolution change, return to normal
+ } else {
+ pinhack.trigger = false;
+ printf("trigger values evalueted but not triggered! Current resolution: %dx%d\n",width,height);
+ };
+}
vga.draw.lines_total=height;
vga.draw.parts_lines=vga.draw.lines_total/vga.draw.parts_total;
vga.draw.line_length = width * ((bpp + 1) / 8);
@@ -1581,6 +1604,11 @@
vga.draw.width = width;
vga.draw.height = height;
+ if ( pinhack.trigger ) {
+ if ( pinhack.doublewidth == "yes" ) doublewidth=true;
+ if ( pinhack.doublewidth == "no" ) doublewidth=false;
+ printf("PINHACK: Doublewidth: %s\n",pinhack.doublewidth);
+ }
vga.draw.doublewidth = doublewidth;
vga.draw.doubleheight = doubleheight;
vga.draw.aspect_ratio = aspect_ratio;
Index: src/dos/dos_files.cpp
===================================================================
--- src/dos/dos_files.cpp (revision 4258)
+++ src/dos/dos_files.cpp (working copy)
@@ -29,6 +29,7 @@
#include "dos_inc.h"
#include "drives.h"
#include "cross.h"
+#include "pinhacks.h"
#define DOS_FILESTART 4
@@ -526,6 +527,11 @@
if (flags>2) LOG(LOG_FILES,LOG_ERROR)("Special file open command %X file %s",flags,name);
else LOG(LOG_FILES,LOG_NORMAL)("file open command %X file %s",flags,name);
+ if ( pinhack.enabled && pinhack.specifichack.pinballdreams.enabled ) {
+ if ( !strcmp(name,"flippers.spr") ) { printf("PINHACK: pinhackpd: flippers.spr loaded, hack should trigger on next resolution change.\n");
+ pinhack.specifichack.pinballdreams.trigger=true; };
+ }
+
DOS_PSP psp(dos.psp());
Bit16u attr = 0;
Bit8u devnum = DOS_FindDevice(name);
Index: src/dosbox.cpp
===================================================================
--- src/dosbox.cpp (revision 4258)
+++ src/dosbox.cpp (working copy)
@@ -42,6 +42,7 @@
#include "ints/int10.h"
#include "render.h"
#include "pci_bus.h"
+#include "pinhacks.h"
Config * control;
MachineType machine;
@@ -130,6 +131,19 @@
bool ticksLocked;
void increaseticks();
+scrollhack pinhack;
+
+void parsetriggerrange (const char*&range,int &min, int &max, char delim) { // PINHACK stuff
+ char* range_delim = const_cast<char*>(strchr(range,delim));
+ if(range_delim && * range_delim) {
+ min = atoi(range);
+ max = atoi(range_delim+1);
+ }
+ else if (!range_delim) { // single value given
+ max = min = atoi(range);
+ }
+}
+
static Bitu Normal_Loop(void) {
Bits ret;
while (1) {
@@ -381,6 +395,30 @@
else E_Exit("DOSBOX:Unknown machine type %s",mtype.c_str());
}
+static void PINHACK_Init(Section * sec) {
+ Section_prop * section=static_cast<Section_prop *>(sec);
+ /* PINHACK config file parsing */
+ pinhack.enabled=(section->Get_bool("pinhack"));
+ const char* pinhacktriggerwidthrange=section->Get_string("pinhacktriggerwidth");
+ const char* pinhacktriggerheightrange=section->Get_string("pinhacktriggerheight");
+ pinhack.doublewidth=section->Get_string("pinhackdoublewidth");
+ pinhack.expand.height=(section->Get_int("pinhackexpandheight"));
+ pinhack.expand.width=(section->Get_int("pinhackexpandwidth"));
+ parsetriggerrange ( pinhacktriggerheightrange, pinhack.triggerheight.min, pinhack.triggerheight.max, '-' );
+ parsetriggerrange ( pinhacktriggerwidthrange, pinhack.triggerwidth.min, pinhack.triggerwidth.max, '-' );
+ if ( ( pinhack.triggerwidth.min == 0 ) && ( pinhack.triggerwidth.max == 0 ) ) pinhack.triggerwidth.max=9999;
+ printf("PINHACK: Your DOSBox has been hacked with pinball hacks V %d ",PINHACKVERSION);
+ if (pinhack.enabled) {
+ printf("and enabled in your config file!\n");
+ printf("PINHACK: width settings: trigger at:");
+ printf("%d-%d, expand to %d\n",pinhack.triggerwidth.min, pinhack.triggerwidth.max,pinhack.expand.width);
+ printf("PINHACK: height settings: trigger at:");
+ printf("%d-%d, expand to %d\n",pinhack.triggerheight.min, pinhack.triggerheight.max,pinhack.expand.height);
+ printf("PINHACK: doublewidth: %s\n",pinhack.doublewidth);
+ }
+ else printf("but disabled in your config file!\n");
+ pinhack.specifichack.pinballdreams.enabled=(section->Get_bool("pinhackpd"));
+}
void DOSBOX_Init(void) {
Section_prop * secprop;
@@ -410,6 +448,42 @@
"hercules", "cga", "tandy", "pcjr", "ega",
"vgaonly", "svga_s3", "svga_et3000", "svga_et4000",
"svga_paradise", "vesa_nolfb", "vesa_oldvbe", 0 };
+
+ // PINHACK: pinhack config file section
+
+ secprop=control->AddSection_prop("pinhack",&PINHACK_Init, true);
+
+ Pbool = secprop->Add_bool("pinhack",Property::Changeable::Always,false);
+ Pbool->Set_help("Boolean: Enable pinball hacks to display whole table at once. Not enabled per default.");
+
+ Pstring = secprop->Add_string("pinhacktriggerwidth",Property::Changeable::Always,"0");
+ Pstring->Set_help("The X resolution (width) the pinball hack should trigger at. It is not checked by default or if set to 0. Can be a range.");
+
+ Pstring = secprop->Add_string("pinhacktriggerheight",Property::Changeable::Always,"350");
+ Pstring->Set_help("The Y resolution (height) the pinball hack should trigger at. Default is 350 (good for Pinball Fantasies). Can be a range.");
+
+ Pint = secprop->Add_int("pinhackexpandwidth",Property::Changeable::Always,0);
+ Pint->SetMinMax(0,4000);
+ Pint->Set_help("The X resolution (width) DOSBox will expand to if pinball hack is enabled and triggers.\n"
+ "Not very useful probably, but provided here in case someone finds a game where it is useful!");
+
+ Pint = secprop->Add_int("pinhackexpandheight",Property::Changeable::Always,608);
+ Pint->SetMinMax(1,4000);
+ Pint->Set_help("The Y resolution (height) DOSBox will expand to if pinball hack is enabled and triggers.");
+
+ Pbool = secprop->Add_bool("pinhackpd",Property::Changeable::Always,false);
+ Pbool->Set_help("Boolean: Enable pinball dreams to work correctly during intros. Default:false\n");
+
+ Pbool = secprop->Add_bool("pinhackpsycho",Property::Changeable::Always,false);
+ Pbool->Set_help("Boolean: Psycho Pinball tilt craphics are messed up if hack enabled. TODO, this is a placeholder and has no function currently.");
+
+ Pstring = secprop->Add_string("pinhackdoublewidth",Property::Changeable::Always,"normal");
+ Pstring->Set_help("Used to enable forcing (or disabling) doublewidth with pinhack. The original patch disabled it,\n"
+ "but you may find it better enabled, or left to decide by dosbox and use aspect ratio correction insread.\n"
+ "normal=do not touch the setting, let DOSBox decide. yes=doublewidth. no=no doublewidth");
+
+// PINHACK: end config file section
+
secprop=control->AddSection_prop("dosbox",&DOSBOX_RealInit);
Pstring = secprop->Add_path("language",Property::Changeable::Always,"");
Pstring->Set_help("Select another language file.");