CEGUI - As object

BlitzMax Modules Forums/Brucey's Modules/CEGUI - As object

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sorry for late response, been busy transferring a bazillion files, servers, libraries, databased, etc to new dev pc to be able to test this.

I discovered the problem was that I was setting the data from a bank buffer rather than a streams. I suppose that is because you placed support for streams, not banks. I was under the assumption that there wasn't a difference in allocated data from either, but I learn new things every day.

This was the broken code:
Method loadRawDataContainer(filename:String, dataContainer:TCERawDataContainer, resourceGroup:String)
	Local StrippedName:String = StripDir(filename)
	If FileSize(StrippedName) <> - 1 Then
		DebugLog(StrippedName + " found in main directory. Loading file from path")
		Local stream:TStream = ReadStream(StrippedName)
		Local size:Int = stream.Size()
		Local data:Byte Ptr = MemAlloc(size)
	
		stream.ReadBytes(data, size)
		stream.Close()

		dataContainer.SetSize(size)
		dataContainer.SetData(data)
	ElseIf Package.FileExists(StrippedName) <> - 1 Then
		DebugLog (StrippedName + " found in archive...loading from archive...")
		Local Bank:TBank = Package.LoadFileByName(StrippedName)
		dataContainer.setSize(Bank.Size())
		dataContainer.setData(Bank.Buf())
	Else
		RuntimeError(StrippedName + " data file was not found")
	End If
End Method


Changing:
ElseIf Package.FileExists(StrippedName) <> - 1 Then
	DebugLog (StrippedName + " found in archive...loading from archive...")
	Local Bank:TBank = Package.LoadFileByName(StrippedName)
	dataContainer.setSize(Bank.Size())
	dataContainer.setData(Bank.Buf())


to

ElseIf Package.FileExists(StrippedName) <> - 1 Then
	DebugLog (StrippedName + " found in archive...loading from archive...")
	Local Bank:TBank = Package.LoadFileByName(StrippedName)
	Local Stream:TStream = OpenStream(Bank)
	Local Data:Byte Ptr = MemAlloc(Bank.Size())
	Stream.ReadBytes(Data, Bank.Size())
	dataContainer.setSize(Bank.Size())
	dataContainer.setData(Data)


Fixed the problem.

So basically loading the bank through a stream works. A little sloppy but it works and works well.

Thanks for supporting this brucey!

Now, with this I can allow users to override default files to use their own custom layouts and backgrounds :)