For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

[HP1] ScriptSource, headers and precompiled binaries.

This Board features Harry Potter and the Philosopher's Stone (UE1), Harry Potter and the Chamber of Secrets (UE1) and Harry Potter and the Prisoner of Azkaban (UE2).
Post Reply
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

[HP1] ScriptSource, headers and precompiled binaries.

Post by han »

Based on my headers for Disney's Brother Bear I made headers for Harry Potter and the Philosophers Stone. Afterwards I use a slightly modified UExporter to extract the ScriptSource using the batchexport commandlet.

ScriptSource:
http://coding.hanfling.de/launch/nonofficial/HarryPotterScriptSource.zip
http://coding.hanfling.de/launch/nonofficial/HarryPotterScriptSource11.zip

Unofficial PubSrc:
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_20170323.zip *new*
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_20151205.zip

Precompiled Binaries:
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_Binaries_20170323.zip*new*
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_Binaries_20151205.zip

I would love to see someone using this to make a patch for this game addressing the widescreen issue or to add a multiplayer. :)
Last edited by han on Thu Mar 23, 2017 10:38 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: [HP1] Script Source and UCC

Post by []KAOS[]Casey »

You can't just use setres or ini modify for widescreen, or is FoV locked? There are ways in unreal 1 to just directly use a "set" command to set your fov, if "setfov" is blocked, i think you do set playerpawn desiredfov or fov directly. This is all just off the top of my head
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] Script Source and UCC

Post by han »

The problems are actually more severe. The game UI is scaled to match the horizontal resolution while beeing initially designed for 4:3 resolutions. This basically cuts off parts of the menus. The main menu screen already misses two out of four buttons. However, I haven't checked in detail what is affected. The same issue is still present in Disney's Brother Bear and likely in HP2 too.

It would also be nice to have more resolutions to selectable on the options screen because just 640x480 / 800x600 / 1024x768 are selectable.
Last edited by han on Thu Oct 22, 2015 8:29 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by han »

First public release of my unofficial headers for Harry Potter. See first post for download links.

Readme:
These are Headers/Libs for Harry Potter and the Philosophers Stone 1.1,
to enabled C++ programming for this Game.

They headers are based on unrealpubsrc224v, ut432pubsrc, UnrealPubSrc227i
and ut436-opengldrv-src-090602. The Libs were created with dumpbin/lib.

Contents:
Core Headers/Libs for Core.dll
Engine Headers/Libs for Engine.dll
Window Headers/Libs for Window.dll
DirectX7 Headers/Libs needed for D3DDrv
D3DDrv D3DDrv out of ut432pubsrc with minor changes
OpenGLDrv OpenGLDrv out of ut436-opengldrv-src-090602 with minor changes
SamplePackage Sample for packages out of ut432pubsrc
SampleNativePackage Sample for native packages out of ut432pubsrc
Launch Launcher based on unrealpubsrc224v/UnrealPubSrc227i
UCC UCC out of ut432pubsrc with minor changes

12/2015 by Sebastian Kaufel

Visit http://coding.hanfling.de/launch/
I also uploaded prebuild binaries for the projects in the PubSrc (UCC, Launch, D3DDrv, OpenGLDrv). I haven't changed much on these compared to their orginal source. For UCC it is basically just added loading exporters and factories based on int entries. Launch is not exactly as in the game, but instead shows the config wizard (and does not enforce SoftDrv or D3DDrv anymore) and also includes code to make sure at least 5ms passes between frames (else the game runs too fast). Log files are not saved in the user directory. D3DDrv/OpenGLDrv basically just have the DrawTriangles/MaxVertices implemented compared to their original source.

So have fun with it.
Last edited by han on Sat Dec 05, 2015 12:35 am, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
Solid_Snake FirePhoenix
OldUnreal Member
Posts: 153
Joined: Fri Jul 31, 2015 4:16 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by Solid_Snake FirePhoenix »

so basically the game can be modded now?
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by han »

Yes.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
Solid_Snake FirePhoenix
OldUnreal Member
Posts: 153
Joined: Fri Jul 31, 2015 4:16 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by Solid_Snake FirePhoenix »

well all right! good job han solo. I hope too see some downloadable mods for the HP game in the near future. imagine the whole game being remade as a whole unreal game where you gib skarrj throughout hogwarts. most of the maps in HP1 look like perfect DM maps. ;D
User avatar
dustinechoes849
OldUnreal Member
Posts: 480
Joined: Sat Feb 28, 2015 1:56 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by dustinechoes849 »

well all right! good job han solo. I hope too see some downloadable mods for the HP game in the near future. imagine the whole game being remade as a whole unreal game where you gib skarrj throughout hogwarts. most of the maps in HP1 look like perfect DM maps. ;D
we need this
Image
Image
Image
Image
Image
User avatar
djbff
OldUnreal Member
Posts: 5
Joined: Tue Jan 17, 2017 3:50 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by djbff »

Based on my headers for Disney's Brother Bear I made headers for Harry Potter and the Philosophers Stone. Afterwards I use a slightly modified UExporter to extract the ScriptSource using the batchexport commandlet.

ScriptSource:
http://coding.hanfling.de/launch/nonofficial/HarryPotterScriptSource.zip
http://coding.hanfling.de/launch/nonofficial/HarryPotterScriptSource11.zip

Unofficial PubSrc:
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_20151205.zip

Precompiled Binaries:
http://coding.hanfling.de/launch/nonofficial/HarryPotterPubSrc11_Binaries_20151205.zip

I would love to see someone using this to make a patch for this game addressing the widescreen issue or to add a multiplayer. :)
This is awesome, thanks so much. I got a wave of nostalgia recently and decided to start playing with this and the second HP game again, and was wondering if any of the fancy Unreal Engine 1 enhanced renderers could be used to pretty it up any. An OpenGL driver is definitely a step in the right direction!

Being super curious what the insides of a game that defined my childhood actually looked like, I've spent about an hour or so going over the code and seeing how they scripted everything. Some of the comments are pretty funny ;D :

Code: Select all

//Uh oh, is this a hack?  dunno.  Seems ok.  If Vold has been killed, add 60 points to harrys house points.
playerHarry.Add60HousePointsToGryffindor();
But to more interesting matters, I've done some digging on the widescreen menu clipping issue and I think I've found the root of it. Everything in the menus seems to be layed out internally on a canvas of 640x480 and then stretched to whatever resolution you're running at. The problem is that the way it sets the dimensions using this code (example taken from FEBook.uc starting at line 730):

Code: Select all

if(bResolutionChanged)
            {
            root.SetScale(root.realwidth/640);
            bResolutionChanged=false;
            }
This code would work great for any screen that had an aspect ratio the same as 640x480 but would result in a cropped screen exactly like what we're seeing when using any other aspect ratio. A possible fix:

Code: Select all

if(bResolutionChanged)
            {
            root.SetScale(root.realheight/480);
            bResolutionChanged=false;
            }
This means that the menu will be to the left side instead of being centred and will have a big bar to its right, but will not be cropped at the bottom at any resolution wider than 640x480. This will need to be fixed in a couple places, but is probably easy as a project-wide search-and-replace. Ideally, we could also figure out a way to centre the menu canvas as well (x origin = root.realwidth / 2 - (root.realheight * (4/3)) / 2  would work on the math end, we'd just need to inject that value where it counts).

The problem now is that I have no idea how to make a patch from these .uc files to test it out. I'm pretty new to tinkering with the Unreal Engine so you'll have to forgive my disorientation. Can you instruct me on how to do this?

Also, have you tried this source extraction process with HP2: Chamber of Secrets yet? It's not as badly affected by the widescreen clipping bug as HP1 but it would be nice to take a look at its guts and use an updated D3D or OpenGL renderer with it as well.
Last edited by djbff on Tue Jan 17, 2017 5:29 am, edited 1 time in total.
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by han »

Being super curious what the insides of a game that defined my childhood actually looked like, I've spent about an hour or so going over the code and seeing how they scripted everything. Some of the comments are pretty funny ;D
Sound like a resonable start.
But to more interesting matters
I think one could tinker with options for stretched/touch inside/unscaled center when it comes to the general layout. Another relevant point would be to add some dynamic resolution selection as other games offer. Code for that can be found in like most other games...
The problem now is that I have no idea how to make a patch from these .uc files to test it out. I'm pretty new to tinkering with the Unreal Engine so you'll have to forgive my disorientation. Can you instruct me on how to do this?
I recommend starting with reading: http://www.hypercoop.tk/infobase/archive/unrealtech/frameset.htm
Starting at "Level Design" all the way down. "Mod Development" should cover the basic about how to build a package. However there might be some subtle differences. Looks like some games including HP1 try to even recompile scripts if (afaik) the last modification timestamp of the script files is newer than the package file (touch will help), which can be annoying.

In general there are two options for a patch: Create additional packages, and pull in your classes as there are numerious config options in the ini file (Console (as a start for replacing the rootwindow class and other ui stuff), GameInfo, Player class, etc.).

The other option is to rebuild the stock packages. Typically this is a bad idea as this can easily conflict with other people work, but I don't think this will be an issue for this game at all, and probably the better starting point for a patch project. However, this requires that one does have the (extracted) resources the package imported. [Eventually commenting out the resource import lines without deleting the package files with the changed behaviour when recompiling does actually work without having the resources].

In any case, currently it is not possible to extract all resources in HP1, but I started porting over a heavily stripped down version of my toolkit package and started to extending it to support exporting of the remaining required resources. I'll release that once I wrapped up the remaining things. So far, I already fixed a couple of issues in the headers during the process, so there will be an updated header release too. Below is a breakdown of resource types include in the *.u files. Typically you won't require all types for each package, so some packages end up beeing easier to rebuild from scratch.

Packages
Though I haven't checked it in detail, it looks like they actually ship all packages they embedded inside the *.u files. Otherwise I already ported over my commandlet to extract those.

Sounds
Already supported out of the box.

Textures
Also supported out of the box, might fail when encountering ScriptedTextures or FractalTextures inside embedded packages. However my batchexportcommandlet won't fail in this case. Only thing one needs to be aware of is that for very low texture dimensions the stock texture exporters do have troubles. But usually either pcx or bmp will work even for those.

James Meshes (*_[a|d].3d)
Extracting those with my exporter derived from those Smirftsch gave me once seems to work fine. And yes there are a few of them inside HP1.

Bitmap Fonts
Basically those are textures with some glyph borders, which do get removed during import. I have an exporter with some heuristics which can reconstruct those, and it seems to work correct for HP1 too.

TrueType Fonts
These come in two flavors in HP1. The 'classic' like for any other game beeing sampled while imported, so in this case you need the Fonts installed on your system. Whats new in HP1 is the 'RenderNative' option. In this case just the font name and height is stored. So you won't have to worry about those.

Skeletal Meshes/Animations
I have some limited success with the SkeletalMesh and Animation exporter Smirftsch supplied. Extracting SkeletalMeshes does work and they appear to show up correct inside a *.psk viewer. I think I still got a crash when encountering a specific SkeletalMesh, but I need to recheck this.
For Animations the situation isn't that easy. They did some changes to the storage of the skeletal animation. One being that they just store references to (probably the) KeyQuat/Pos/Time inside the AnalogTracks to some per Animation array, which now isn't any issue anymore. But the other change is that they seem to not use FQuat/FVector/FLOAT for those, but instead 6/6/1 byte. So I need to figure out their storage format, but I still have a couple of ideas to try left...

Gestures
This is a HP specific resource (using the PATTERN IMPORT lines) with *.hpg (Harry Potter Gesture?) files. I haven't checked it yet, but I suspect that these are some homebrew format which more or less mirrors whats inside the Gesture class. So far I don't expect that this would get to complicated to figure out.

Also, have you tried this source extraction process with HP2: Chamber of Secrets yet? It's not as badly affected by the widescreen clipping bug as HP1 but it would be nice to take a look at its guts and use an updated D3D or OpenGL renderer with it as well.
I tried a bit of a different approach though, though I have some apparently more or less working UCC exectuable for it now. However the script source have been stripped out of all packages but Core, Engine and Editor (same as for Brother Bear), so one doesn't get very far so easily. In any case I haven't yet started any major work on building a header set for HP2 to build an run some more own C++ code. More or less I wan't to wrap up things for HP1 and probably for Brother Bear first as HP2 is the game they released in between. So chances are that most of the stuff is sth. in between.

I'll build headers for this game at some point, but that is likely not gonna happen anytime soon. However regarding the missing script text, it consists of two parts: the resource imports and the 'real' script code. I have some commandlet to reconstruct the resources import lines, though it currently lacks support for SkeletalMeshes, the special rendernative ttf fonts and Gestures. In any case one needs to figure out otherwise used TTF fonts by hand. When it comes to 'real' script code, I currently working on some script text rebuilder/function decompiler commandlet. So far I'm halfway through with the easy part as in reconstructing the general class layout and defprops, e.g. what one gets for free when one runs it in context of the game. There are other script decompilers out there. Afaik all of them are standalone tools, and I have no idea how reliable they are and whether they support HP2. The only decompiler I tried was the one in UExplorer, and it has a lot of issues, most noticable a lot of declarations beeing off, functions inside state code entirely missing and unusuable defaultproperties. So in any case, even if I just get to the point before decompiling functions it'll probably still be a nice complement to other script decompilers.
Another rather exotic idea I have is to make use of the stored ScriptCRC (unless it got invalidated when the script source was stripped) to build a database of the ScriptCRCs in HP2 and compare it to those of HP1 (and eventually other games). I have the hope that this will at least yield some matches to get back the exact source. Probably there are a lot of classes inside UWindow unchanged.

So much for now..
Last edited by han on Mon Jan 23, 2017 11:23 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by han »

Small status update:
I added support for Gestures to HTK. So far the the exported and reimported and exporterd again gesture files are the same on disk. I still do want to write some simple diff commandlet to compare them inside the packages to remove last doubts. I expect them to fully work though.

Situation for SkeletalMeshes and Animations is more complicated. The crash I prior reported was a bug in the code I got and trivial to fix. Remapping of the PolyFlags to the in psk PolyFlags was also missing and I added that.

However after a lot of experimentation I noticed that the reference skeleton in the psk files are sometimes flipped, rotatated, etc. and that the bone animations not applied to the mesh faces did otherwise play fine.

Turned out they flipped the Orientation.W component of the root bone compared to ut. After applying this change to the reference skeletons root bone on export the reference skeleton exports fine, the animations applied to the mesh don't screw up anymore but when playing the animations the mesh jumps to the orientation of the reference skeleton without the Orientation.W flip. I think I need to apply this flip at some point in the animation exporter too, but I haven't spent much time on this yet.

One thing I want to do for the skeletal mesh exporter is to double check on the Materials as I suspect that eventually some remapping is required there in certain situations. Also I want to rebuild material names in a way the ActorX exporter would produce the same ordering/polyflags if this mesh would be loaded in this form into Max/Maya. Basically I would like to wrap this up before moving towards working on the animation export.

For animation export there are a few things worth to mention. PSA files do use a fixed animation rate, so the time between animation frames is always constant. However the animation importer can drop animation frames so this rate gets non constant. I'm not aware whether the importer can add additional keyframes at some random point in between. If I understood it correctly so far, the current animation exporter source exports NumFrames# animation frames as stored in the FMeshAnimSeq. So far I don't know whether this value refers to the original number of keyframes or the reduced one.
Afterwards the exporter exports make up NumFrames equal distanced timestamps to be and exports the animation at this frames, either by interpolation or by taking an animation frame as is by some small epsilon test. However in case of KWG the animation frames are always integer multiples of a floating point value (e.g. quantized), so it would make sense to either add an option (in case AnimSq.NumFrame is not the orginal pre import keyframe count) or to always (in case AnimSq.NumFrame is the original pre import keyframe count) to match this quantization on import and export the existing keyframes as is (after decompression them out of the FAnimVec's) and just interpolate the positions in between. In any case I need to check if this is also true for animations in like UT, where the timestamps of the animation frames are float. Eventually the current code actually does it implicit by the epsilon test. If this in fact the case I prefer rewriting the code to make this explicit.

So much for my SkeletalMesh/Animation trial by fire first encounter.
Last edited by han on Wed Feb 01, 2017 2:19 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by han »

New Header release, including rebuild binaries out of the PubSrc. For the binaries I think the only relevant changes was an addition of an -preferences option to HP.exe, which just pops up the preferences aka advanced options windows. This feature is sort of handy for HTK.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
Huckleberry Pie
Posts: 4
Joined: Sat Nov 03, 2018 9:27 am

Re: [HP1] ScriptSource, headers and precompiled binaries.

Post by Huckleberry Pie »

well all right! good job han solo. I hope too see some downloadable mods for the HP game in the near future. imagine the whole game being remade as a whole unreal game where you gib skarrj throughout hogwarts. most of the maps in HP1 look like perfect DM maps. ;D
Excuse for the bump, but I've actually ported the Hogwarts hallway map from HP3 to UT2003 some eight years ago. It was just the matter of figuring out how to export the static meshes and reimport them to something that UT2003 can understand, albeit with some flickering issues if I may recall. I've lost the sources to them unfortunately, but it was fun fragging random characters in that map lol.
Post Reply

Return to “Harry Potter Series”