New BMax version - post-install mod tweaks?

BlitzMax Forums/BlitzMax Programming/New BMax version - post-install mod tweaks?

GfK(Posted 2014) [#1]
Hello.

When I installed a version of Blitzmax ages ago, I made a .txt file containing instructions on how to make the various little module tweaks (i.e. adding/enabling the maximise gadget on a window). I did this so that in the future, I wouldn't have to turn the forums upside-down for hours on end looking for all the info I needed to restore certain functionality that the likes of BFG required.

Now v1.50 has appeared (I'm currently on 1.48), can I find said .txt file? Can I hell! It's gone. I know there was at least a couple of essential module tweaks detailed in there, other than the maximise thing.

Anybody else done such a list of tweaks that they might be able to share?


therevills(Posted 2014) [#2]
Try using KDiff on your 1.48 and the new 1.50, and compare the bmx files.

Anyway here are the essential tweaks I need to add:
* d3d9graphics.bmx
Global _d3dOccQuery:IDirect3DQuery9 'Added by Col 13.01.2012

Function OpenD3DDevice( hwnd,width,height,depth,hertz,flags )
...
	'Occlusion Query - Added by Col 13.01.2012
	If Not _d3dOccQuery
		If _d3ddev.CreateQuery(9,_d3dOccQuery)<0 '9 hardcoded for D3DQUERYTYPE_OCCLUSION
			DebugLog "Cannot create Occlussion Query!"
		EndIf
	EndIf
	If _d3dOccQuery _d3dOccQuery.Issue(2) 'D3DISSUE_BEGIN
	

	
	Return True
End Function

Function CloseD3DDevice()
	_d3dDevRefs:-1
	If Not _d3dDevRefs

		For Local t:TD3D9AutoRelease=EachIn _autoRelease
			t.unk.Release_
		Next
		_autoRelease=Null
		
		If _d3dOccQuery _d3dOccQuery.Release_	'Added by Col 13.01.2012
		_d3dOccQuery = Null 					'Added by Col 13.01.2012
		
		_d3dDev.Release_
		_d3dDev=Null
		_presentParams=Null
	EndIf
End Function

Function ResetD3DDevice()
	If _d3dOccQuery _d3dOccQuery.Release_ 'Added by Col 13.01.2012

	_d3dDev.Reset( _presentParams ) ' Added by Steve
		
	'Added by Col 13.01.2012
	If _d3ddev.CreateQuery(9,_d3dOccQuery)<0
		DebugLog "Cannot create Occlussion Query!"
	EndIf
	If _d3dOccQuery _d3dOccQuery.Issue(2) 'D3DISSUE_BEGIN

End Function

	'NOTE: Returns 1 if flip was successful, otherwise device lost or reset...
	Method Flip( sync )
	
		Local reset

		If sync sync=D3DPRESENT_INTERVAL_ONE Else sync=D3DPRESENT_INTERVAL_IMMEDIATE
		If sync<>_presentParams.PresentationInterval
			_presentParams.PresentationInterval=sync
			reset=True
		EndIf
		
		Select _d3dDev.TestCooperativeLevel()
		Case D3DERR_DRIVERINTERNALERROR ' added by Col
			Throw "D3D Internal Error"


Type TD3D9GraphicsDriver Extends TGraphicsDriver

	Method Create:TD3D9GraphicsDriver()
		'create d3d9
		If Not d3d9Lib Return Null      '<-------ADDED

Method Graphics:TD3D9Graphics()
		Return _graphics
	End Method

	Method Flip( sync )
		Local present = _graphics.Flip(sync)
		If UseDX9RenderLagFix Then
			Local pixelsdrawn
			If _d3dOccQuery
				_d3dOccQuery.Issue(1) 'D3DISSUE_END
				
				While _d3dOccQuery.GetData( Varptr pixelsdrawn,4,1 )=1 'D3DGETDATA_FLUSH
					If  _d3dOccQuery.GetData( Varptr pixelsdrawn,4,1 )<0 Exit
				Wend

				_d3dOccQuery.Issue(2) 'D3DISSUE_BEGIN
			EndIf
			'Can read back pixelsdrawn if really wanted :P
		End If
		
		Return present
	End Method

* graphics.bmx
Global UseDX9RenderLagFix% = 0 ' new boolean



Since the modules are now licensed as zlib/libpng, maybe we should create a Hg/Git repo of them and apply our essential patches there?


Brucey(Posted 2014) [#3]
Since the modules are now licensed as zlib/libpng, maybe we should create a Hg/Git repo of them and apply our essential patches there?


There was a lot of interest in that when I mentioned it last month.

I just assumed no-one used BlitzMax anymore and they'd all moved away to something else.


GfK(Posted 2014) [#4]
@therevills - thanks for that.

@brucey - I still use Blitzmax and can't see myself ever needing to use anything else for PC/Mac games. I didn't even see that thread - it'd be great if the stuff mentioned above was added as a permanent feature.


Brucey(Posted 2014) [#5]
Can do. If there's anything else, just let me know about it.


Brucey(Posted 2014) [#6]
graphics.bmx doesn't seem to be a good place to put a global that refers to a specific graphics driver.
Why can't it be in d3d9graphics.bmx ?


GfK(Posted 2014) [#7]
A global can surely go anywhere, so d3d9graphics.bmx would be the logical place. Maybe therevills has some reason for it not being there.

Anyhoo, this git repo thing - if I get the latest versions from there, is that 1.50?

(sorry for being dumb, I have no clue about github - it's all alien to me).


Brucey(Posted 2014) [#8]
As far as I am aware, there have been no modifications made to any of the BRL or PUB modules since 1.49 (which is what is there + updates to a bunch of modules)


therevills(Posted 2014) [#9]
A global can surely go anywhere, so d3d9graphics.bmx would be the logical place. Maybe therevills has some reason for it not being there.

Maybe I did at one stage, but search me why I would have put it there now :)

[edit] - could it have been to help with frameworks? For example if we only use DX7, then the global wouldnt have been picked up if it was in d3d9graphics?[/edit]

I totally missed Brucey's post too - top idea ;)


Brucey(Posted 2014) [#10]
But would you use UseDX9RenderLagFix in DX7 ??

Or do you mean in your code, when you don't include DX9, you still want to be able to set the global that wouldn't otherwise be available?


therevills(Posted 2014) [#11]
when you don't include DX9, you still want to be able to set the global that wouldn't otherwise be available?

This :)


Derron(Posted 2014) [#12]
Why not set it as a flag ?

I have not checked the code but shouldn't it be more easier to do it as a new bit of the "flags"-parameter?

Sure there is no "newFlagValue = addFlag(flags)"-globalfunction to make sure that there is no collision in the case uhmm that Mark adds some new one but just use a bigger value to start with "customFlags".


bye
Ron


GfK(Posted 2014) [#13]
Can anybody give me an idiot's guide to snagging the modules from GitHub? I had a look around but I don't understand what I'm supposed to do (Subversion for me).


xlsior(Posted 2014) [#14]
Can anybody give me an idiot's guide to snagging the modules from GitHub? I had a look around but I don't understand what I'm supposed to do (Subversion for me).


Not sure if it's the best way, but this worked for me:


download git for windows from:
http://msysgit.github.com


To set up a new git repo:
Go to destination folder
git clone git://blah.git

...which will create the hidden config files and such.

Not entirely sure what the 'proper' way is to download the changes, but this seems to work for me:

go to the destination folder, that was initialized with the commands above
git.exe checkout -f
git.exe pull

Should download the branch from the server.


Derron(Posted 2014) [#15]
from commandline:
git clone <URL>

But if you go to:
https://github.com/maxmods/brl.mod

have a look at the right side:



So you are able to: just download a ZIP containing everything.

If you use the above git-clone (or the svn-method) you create a local "svn repository". Now you could include your patches - and then push it to your local repo - and then send out an "pull request" so brucey could include it.

But for this it is better to have a github account ... "fork" the project ... "clone" that fork to your local computer, patch there, push your commits to your fork - and then do a pull request (so you can handle many things with github).


I do not know how to do it "graphically" but within the (on mac and linux hidden) directory ".git" of a local repo there is a "config"-file.

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@...
[branch "master"]
	remote = origin
	merge = refs/heads/master
[user]
	name = YOUR NAME
	email = EMAIL_USED@...
[remote "upstream"]
	url = git://github.com/geany/geany.git
	fetch = +refs/heads/*:refs/remotes/upstream/*


The above code does the following: it add YOUR github fork as a "ORIGIN" and the original one (in that case it would be bruceys project) as "UPSTREAM".
You then just send your commits to "origin" but fetch updates from "UPSTREAM" ...
For more convenience use TortoiseGIT or similar things for GIT (don't know the current Windows state).

https://code.google.com/p/tortoisegit/


Another nice thing is: use Softlinks to this repos. In Linux this is "symlinking". Means: instead of copying the files to your blitzmax/mod/... folder, you create a "link" to your repo there.


EDIT: there was someone faster... so excuse the doubled explanation.

bye
Ron


Brucey(Posted 2014) [#16]
Yes, just download it as a zip file. It's easier than setting up git on your box :-)

You'll need both BRL and PUB because they share dependencies.


GfK(Posted 2014) [#17]
I just noticed I can checkout with TortoiseSVN! That's handy, since I already use it.

How come I get a bunch of folders with the actual mod buried away somewhere in a bunch of other folders, though (branches, tags, trunk etc)? Is there something I'm doing wrong as it'd be handy to just have brl.mod and brl.pub in my mods folder, so I can just right-click>>update.


Derron(Posted 2014) [#18]
You should not checkout everything but just the branch/trunk you want.

Like said - you can then symlink the innerlaying folders (brl.mod and pub.mod) to your BlitzMax-Folder. Using this your BlitzMax-installation uses these folders while you still can have them in a folder like "svn-controlled-projects" (or what I do: projectname.SVN).

Just to split "work data" and "application data" (have your custom content on another drive/mapped share... than your normal application data).


bye
Ron


GfK(Posted 2014) [#19]
Like said - you can then symlink the innerlaying folders (brl.mod and pub.mod) to your BlitzMax-Folder.
....I can do the what now??? o_O

I know I asked for an idiot guide - I'm clearly a bigger idiot than you had me down for, because I don't understand anything you just said.


Derron(Posted 2014) [#20]
Ok ..you know that you can create folders in your windows explorer.
But you can also create "links" (right click ... creat link). I doubt that BlitzMax recognizes them. But with tools/commandline you could create soft- or hardlinks.

For further details: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx


Advantage is like said: you can let your apps "think" something is there which is located elsewhere. Eg. you can have all "real" data in a "Data"-partition/folder so the backup is done more easily.


bye
Ron