Code Monkey home page Code Monkey logo

dosbox-pinhack's People

Contributors

dexterrbdn avatar felipesanches avatar omigeot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dosbox-pinhack's Issues

Scaling Issue

The patch is great, however whatever I did I could not find a way to get rid of the black borders with this patch.

For this reason I have introduced a new configurable parameter under the pinhack section that allows you to set a custom aspect ratio. With this you will get a perfectly scaled output.

It uses tha aspect_ratio so "aspect=true" in the .conf file needds to be set

.conf file settings:

[sdl]
fullresolution   = desktop
windowresolution = 1080x1920 (or whatever you have)
output           = overlay (or opengl)

[pinhack]
pinhackaspectratio   = 214 (for Pinball Dreams), 187 for Pinball Fantasies

[render]
aspect=true
scaler=none

I modified the following source code files after applying your patch:

vga_draw.cpp:

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);
       };
		aspect_ratio = pinhack.aspectratio;
	}

pinhacks.h

/*
 * 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;
	double aspectratio;
	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 */

dosbox.cpp

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");
		//romans aspect patch
	pinhack.aspectratio=(double)(section->Get_int("pinhackaspectratio")) /100.0;
	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);
		if (pinhack.aspectratio == 0 ){
			pinhack.aspectratio=100;
			printf("PINHACK: aspectratio not found, adusting to 1\n");
			};
		printf("PINHACK: aspectratio: %f\n",pinhack.aspectratio);
	}
	else printf("but disabled in your config file!\n");
	pinhack.specifichack.pinballdreams.enabled=(section->Get_bool("pinhackpd"));
}


void DOSBOX_Init(void) {
	Section_prop * secprop;
	Section_line * secline;
	Prop_int* Pint;
	Prop_hex* Phex;
	Prop_string* Pstring;
	Prop_bool* Pbool;
	Prop_multival* Pmulti;
	Prop_multival_remain* Pmulti_remain;

	SDLNetInited = false;

	// Some frequently used option sets
	const char *rates[] = {  "44100", "48000", "32000","22050", "16000", "11025", "8000", "49716", 0 };
	const char *oplrates[] = {   "44100", "49716", "48000", "32000","22050", "16000", "11025", "8000", 0 };
	const char *ios[] = { "220", "240", "260", "280", "2a0", "2c0", "2e0", "300", 0 };
	const char *irqssb[] = { "7", "5", "3", "9", "10", "11", "12", 0 };
	const char *dmassb[] = { "1", "5", "0", "3", "6", "7", 0 };
	const char *iosgus[] = { "240", "220", "260", "280", "2a0", "2c0", "2e0", "300", 0 };
	const char *irqsgus[] = { "5", "3", "7", "9", "10", "11", "12", 0 };
	const char *dmasgus[] = { "3", "0", "1", "5", "6", "7", 0 };


	/* Setup all the different modules making up DOSBox */
	const char* machines[] = {
		"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");

//romans patch
	Pint = secprop->Add_int("pinhackaspectratio",Property::Changeable::Always,100);
	Pint->Set_help("Used to force a custom aspect Ratio onto Dosbox, currently only works in Windowd Mode. Usefull to get Pinball Tables Full Size with 16:9 Screens. Pinball Fantasies value is 1.87");

// PINHACK: end config file section

I hope you like these modifications and put them into your "official" patch :)
I have added a compiled windows 10 .exe if you want to do a quick test.
(I will also put the precompiled exe into the topic at the vogons forum.)

dosboxAllPinballscd.zip
dosbox_sourcecode_and_conf.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.