Now Reading
Runtime Terror

Runtime Terror

2023-04-17 02:12:15

One of many issues i love to do is to gather older growth software program, normally from the 90s or early 2000s. This software program tends to be targeted on desktop software growth as a substitute of the extra trendy give attention to net functions (that i personally dislike) and so they additionally are typically mild on sources. To date i’ve discovered Visible Primary 4, Visible Primary 5, Borland Delphi 2 (which i additionally had second hand on the previous when it was barely extra related, however one way or the other i misplaced the CD when i left my mum or dad’s place years in the past), Borland JBuilder 2 and Borland C++ 5.0. All these have been purchased from eBay second hand and normally are in CD solely kind (apart from Visible Primary 5 for which i’ve the manuals, companion CDs, and so forth) since that is what most individuals are likely to preserve round (nicely, that and the extra full variations are likely to price a ton extra, particularly if they’re nonetheless in shrink-wrap state – additionally Visible Studio 6 due to VC6 and VB6 that are nonetheless be common, particularly VB6, are typically priced particularly excessive).

Lately i managed to seize two new instruments: the unique Borland C++ Builder and Klik & Play. The previous is CD solely whereas the latter got here with the unique (barely used) handbook. I’ll publish about Okay&P at some later level since i’m planning on making a clone of it in Lazarus, however for now i’ll give attention to Borland C++ Builder (i’ll check with the unique model as Borland C++ Builder and trendy variations as merely C++ Builder because it bought via a number of arms after Borland).

Borland C++ Builder Screenshot

Borland C++ Builder is a RAD IDE targeted on desktop functions for Home windows. The unique model from 1997 (the one i’ve bought) produces solely 32bit executables though trendy variations use Clang to provide 64bit executables (the 32bit compiler continues to be primarily based on the unique although). It is interface is made up of a fundamental “toolbar/menu” window which comprises the frequent open, save, and so forth instructions and a element palette that you just use to draw the person interface of your packages. As well as a bunch of different helper floating home windows can be found, normally the Object Inspector which comprises the properties and occasions of the chosen element, the Code Editor the place you edit this system’s supply code and the Kind Designer which acts as a WYSIWYG editor for the person interface.

The floating home windows setup was taken from Delphi, which in flip i believe took it from Visible Primary 1 (though it wasn’t till Visible Primary 2 {that a} devoted properties window could be used). I am unsure if this rabbit gap goes additional. Lazarus, the open supply, cross platform, almost-Delphi-compatible RAD IDE additionally makes use of the identical setup. This UI format is liked by many, me included, though if i’ve to be sincere it may be a bit annoying with trendy 1920×1080 and 2560×1440 resulutions having the principle home windows (menubar, inspector and messages – the latter for Lazarus because it makes use of a separate message window) spaced out. Trendy variations of Delphi and C++ Builder have a “docked” mode which makes the UI work inside a single window (and actually, the UI is now designed to work like that whereas the non-docked mode is extra of a fallback for individuals who dislike the docked interface). Lazarus additionally has a docked mode, though the shape designer in the intervening time continues to be floating, which makes it unusable.

Borland C++ Builder makes use of an nearly similar interface because the one in all Borland Delphi 2, which is not shocking because the majority of this system was written in Delphi. This desire to Delphi additionally reveals within the C++ language implementation, which has been prolonged significantly to be appropriate with Object Pascal and particularly VCL (Visible Part Library) the appliance framework that each C++ Builder and Delphi makes use of and is written in Object Pascal. In my view, these extensions really feel a bit tacked on and never very nicely thought out. Some components appear to make use of customary C++ options, some components use macros that resolve to C++ extensions and a few components use these extensions straight – just like the __property, __fastcall and __closure key phrases which are mandatory to make use of VCL.

Borland C++ Builder Code

No matter these points, Borland C++ Builder continues to be a C++ compiler (bugs however) and as one, it may well compile and interface with C and C++ packages and libraries. The unique Borland C++ Builder was launched earlier than C++98, though it appears to assist most of it and comes with an STL implementation (the standard of which i am unsure about, contemplating {that a} single use had the compiler emit warnings about mixing signed and unsigned integers). Nonetheless, not like with Delphi (and sadly Lazarus), it’s doable to make use of a standard interface with C/C++ packages (Lazarus has a C header to Free Pascal unit conversion software, however it’s only for C and a bit finicky) and even reuse some libraries (assuming they compile underneath Borland C++ Builder or underneath a compiler that may produce OBJ recordsdata usable by it). As a fast take a look at, i grabbed an expression parsing library written in C, tried in Borland C++ Builder and the code labored effective.

This C/C++ interoperability makes Borland C++ Builder (and C++ Builder no matter present proprietor) a pleasant resolution while you wish to create instruments for C++ packages shortly. Particularly for recreation growth, utilizing C++ Builder for writing the instruments can save a ton of time. One of many best modding instruments – for a lot of gamers nonetheless unsurpassed when it comes to ease of use – is the Aurora Toolset from the primary Neverwinter Nights.

Aurora Toolset

Aurora Toolset, and the entire engine the truth is, was made utilizing C++ Builder. Based mostly on the copyright messade contained in the nwn.exe for the runtime library (Borland C++ – Copyright 1999 Inprise Company), i suppose it was C++ Builder model 4.0 since in keeping with Wikipedia that was the one model launched in 1999. The identical is true (besides maybe the compiler model) for the following installment – Neverwinter Nights 2. NWN2 and its editor was additionally written in C++ Builder.

Nonetheless CodeGear (the Borland spin-off that later was purchased from Embarcadero) did not sustain with requirements which made interfacing with present middleware more durable. In the present day you may discover few libraries to assist C++ Builder (no matter works it does by chance) and Embarcadero would not assist that with their insane costs (1000+ euros for the most affordable model with out limitations), to not point out their DRM that has triggered folks to be kicked out of their IDE (in keeping with messages of their assist discussion board a minimum of).

Theseis PreAlpha Footage

Earlier than i joined Track7 Games to work on the engine of the Theseis game (a tragic story for an additional day), the plan was to make use of C++ Builder to create the instruments for the engine. The engine must compile underneath each C++ Builder and Visible C++ (one thing obligatory since we deliberate to port the sport to XBox 360 and PS3, though the latter was dropped early). By the point i joined, that plan was deserted (presumably due to C++ Builder’s unhealthy C++ assist) and the thought was to make use of the in-game GUI toolkit for the instruments (later that was additionally deserted since we might want so as to add vital performance to the toolkit and since i used to be answerable for the instruments – and wasn’t feeling Neanderthal sufficient to design person interfaces in code 😛 – i made a decision to interface the engine with Lazarus, which was the strategy that was used till the tip).

The same path was adopted by the Aurora Toolset in CD Projekt RED with the primary Witcher recreation: the engine needed to be ported from C++ Builder to Visible Studio and the group construct a brand new editor: D’Jinni.

D'Jinni for The Witcher

And naturally trendy video games don’t appear to make use of C++ Builder for making instruments both, besides perhaps some small builders or builders who’ve left-over tech that they have not improve but. Which is a pity, because the C++ Builder and Delphi (and naturally Lazarus) interface is – in my view – the easiest way to create GUI functions. At the least the unique interface with the floating home windows, i have never used the newer docked variations a lot past the unique Turbo C++ Explorer and Turbo Delphi Explorer that CodeGear launched (and the took away) some years in the past.

In the present day quite a lot of instruments are finished both utilizing a C++ tookit like MFC, wxWidgets or Qt (in video games normally the primary two are used on account of native controls that are likely to interface higher with DirectX engines) or in C# and Home windows Kinds, normally with a Managed C++ interface between the software aspect and the engine aspect. Aside from WinForms, nevertheless, personally i discover the strategy of utilizing a separate interface designer (or worse, an XML description of the interface) a giant step backwards when it comes to making person interfaces. WinForms, like C++ Builder, Delphi and Lazarus, permit for a extra direct connection between the person interface and the language with out pointless steps. In order for you a button to destroy your entity, you draw that button utilizing the IDE’s built-in kind designer, double click on on it (which creates the handler technique and associates it with the clicking occasion of the button) and sort GEntityManager->DestroyEntity( selectedEntity ); (or the equal in your engine) and that’s it, prepared for use. With a separate interface designer (in say xWidgets for instance) you need to place the button in wxWidgets (and fiddle with the wonky format managment it has), save the undertaking, export the XRC, declare the management within the C++ header, affiliate the C++ object with the management utilizing the wxWidgets XRC supervisor, declare the occasion handler perform within the C++ header, implement it within the C++ supply, name Bind or Join to affiliate the MSG_BUTTON_CLICKED occasion with the handler and then write the code. Yeah, not humorous. And so far as i do know, Qt and GTK+ is not significantly better there (the QtCreator IDE would possibly assist a bit with that although however i have never used it personally).

wxFormBuilder - this is not fun

So, to come back again to Borland C++ Builder, i attempted to put in it on my pc, which is a bit on the trendy aspect (Home windows 8.1, i7 4770K CPU, 16GB RAM, and so forth). First i made a decision to attempt to set up it in a digital machine simply in case one thing goes horribly improper, nevertheless it put in completely effective. After that i made a decision to attempt to set up it on my machine correctly, underneath Home windows 8.1. Which, btw, is 64bit.

And there it failed. The set up program is 16bit. For some cause, plainly Borland determined within the 90s to save lots of a couple of KB within the set up program and made it 16bit (no, actually, installers was 16bit within the 90s as a result of 32bit executables have been larger). Nonetheless Microsoft did not present 16bit assist in 64bit Home windows (regardless of it being technically doable, as may be demonstated by Wine which may run 16bit packages underneath 64bit Linux programs). So i could not use the installer.

Thankfully the installer is only a fairly xcopy – all it does is to repeat the recordsdata from the CD to arduous disk (and perhaps arrange a couple of registry keys however these aren’t mandatory, besides if you need documentation to work… which is a pleasant factor, however i will ignore it for now because the assist recordsdata open effective after i put in the winhlp32 viewer from Microsoft’s website). So i copied the recordsdata manually to a listing in my drive and Borland C++ Builder labored completely from there.

With a small exception, in fact: it appears ugly. You see, this system was launched in 1997, earlier than Microsoft added themes within the Home windows UI and it would not assist the themable controls, so it makes use of the beveled ones from Home windows 2000 (one thing i by no means understood was why Microsoft did not add theme assist within the controls straight and as a substitute opted to create a separate set of controls).


Nonetheless regardless of the shortage of themes, it really works (and so far as i do know, there’s a workaround for forcing themes in unthemed packages by including a particular useful resource in them). And it’s a C++ Compiler, which implies that C++ stuff ought to work with it.

See Also

So i made a decision to attempt to write one thing C++-y in it and that needed to be one thing that used OpenGL. First i checked if the OpenGL headers have been there (since IIRC Borland C++ 5.0 did not embrace them, though i would bear in mind improper) and as soon as i made certain that they have been there, i went forth to make a spinning triangle.

In Lazarus to try this is a quite simple method: you make it possible for the lazopenglcontext package deal is put in (it’s supplied out of the field, nevertheless it is not put in by default) and then you definately drop the TOpenGLControl element in a kind. In code you name its MakeCurrent technique, draw OpenGL stuff after which name its SwapBuffers. Easy and neat and due to that (and the utility models i’ve written over time), i exploit Lazarus to strive concepts in OpenGL.

Borland C++ Builder did not comprise an OpenGL management although and so far as i do know, it nonetheless would not. In order for you OpenGL, you need to do it the arduous approach – create a tool context, discover the right pixel format, choose it, create the render context, and so forth. Nicely, the “arduous approach” is barely about 40 strains of code, however nonetheless it’s annoying. So i made a decision to do one thing about it. Particularly, i made a decision to make a TOpenGLViewport (not Management, as a result of causes) for Borland C++ Builder. I am certain there are tons on the market, however i doubt something works with the primary C++ Builder.

And thus i did. I had the management working in a couple of minutes. And that i spent the following few hours making an attempt to determine why the IDE was freezing when i attempted to compile a program utilizing the element positioned from the element palette as a substitute of manually through code.

Because it turned out (after a ton of trial and error) it was as a result of i used the WM_PAINT message to initialize the OpenGL context (first time the message comes, i initialize the context after which name an OnRender callback that the element person is meant to deal with to do the precise rendering). Within the handler, i set the message consequence to 0 (which says to Home windows that i dealt with the message since i did not need Home windows or C++ Builder to mess with the portray), however i forgot to name ValidateRect on the Window’s consumer space which for some cause causes C++ Builder to hold perpetually (in keeping with the documentation, Home windows would attempt to repeatedly ship WM_PAINT messages till the realm was validated, however that did not appeared to occur). This can be a mistake i’ve finished on the previous a couple of instances, however that was the primary time it triggered my IDE to freeze :-P.

And naturally as soon as i had the management up and working, the following step was to write down a small demo for it.

TOpenGLViewport demo

The preliminary concept was to only write the demo with a spinning triangle inside an OpenGL management that coated the complete consumer space of the window. However then what could be the purpose of constructing that in Borland C++ Builder? As a substitute of that, i made a decision to put a couple of controls that may, nicely, management 😛 the rendering of some spheres. I spent a little bit of time getting the lighting proper (not that i had any explicit “proper” in thoughts, in fact). I needed some rim lighting impact, which was finished through the use of 4 directional lights that have been pointing in the back of the spheres with barely offseted instructions. Then a few further directional lights, one for the first “solar” mild and one for the again mild. However as is normally the case, i bought bored after some time and stopped earlier than determining a approach to make a extra compelling background. In any case, the demo was prepared.

Whereas i used to be penning this publish (which already took me by itself a couple of hours), i made a decision to attempt to see if the management works underneath the most recent model of C++ Builder, Embarcadero C++ Builder XE7. Embarcadero presents 30 day trials (in any other case there wasn’t an opportunity i might strive it – the Skilled license prices €1278 and the one cheaper resolution, at €257, forbids its use should you make greater than $1000 per 12 months) so i downloaded one and began putting in it. After about 40 to 50 minutes of ready (nicely, i used to be penning this really), the set up completed and i used to be in a position to… do nothing as a result of the DRM was failing since i had no community enabled. Enabling it did not assist a lot, although, because it looks as if between Borland C++ Builder 1 and Embarcadero C++ Builder XE7 one thing modified in this system and the element would not compile. I needed to change all headers from <vclblah... to <blah...., do some typecasts since HANDLE wasn’t the identical anymore and a few different adjustments. The element now compiled and i used to be in a position to create a package deal with it (apparently it’s wanted now), nevertheless it wasn’t exhibiting up within the element palette. Greater than that, the undertaking format had modified and the outdated one (which used a .mak extension – it was a “easy” makefile) wasn’t even acknowledged. I created a brand new VCL undertaking, copied the recordsdata from the instance however -expectedly- the opening it might present an error concerning the lacking TOpenGLViewport element. On the finish i did not handle to make it work. I might most likely make it by making a brand new element after which copying the recordsdata over, however at that time i misplaced curiosity.

And… hell… what did they do to C++ Builder?

This system is a bloated mess with a really person hostile UI that has a ton of buttons, menus, panels, icons… i suppose they’d one way or the other to clarify the ridiculous costs :-/

Btw, you possibly can obtain the Borland C++ Builder TOpenGLViewport management from here.

Source Link

What's Your Reaction?
In Love
Not Sure
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top