WEBVTT
Kind: captions
Language: en

00:00:02.400 --> 00:00:05.040
By the time you're seeing this&nbsp;
video, it'll be almost two years&nbsp;&nbsp;

00:00:05.040 --> 00:00:08.240
since I first announced that I had&nbsp;
started decompiling LEGO Island.

00:00:08.240 --> 00:00:11.120
And to be honest, I had no&nbsp;
idea where it was going to go.

00:00:11.120 --> 00:00:13.920
There's a reason I used the word&nbsp;
"started" in the title instead of&nbsp;&nbsp;

00:00:13.920 --> 00:00:17.120
just saying "I'm decompiling LEGO&nbsp;
Island" because I really didn't&nbsp;&nbsp;

00:00:17.120 --> 00:00:20.400
want to make any promises that it was&nbsp;
ever actually going to be finished.

00:00:20.400 --> 00:00:28.000
Yet on December 23, 2024, literally just in time&nbsp;
for Christmas, LEGO Island hit 100% decompiled,&nbsp;&nbsp;

00:00:28.000 --> 00:00:33.120
meaning we effectively have the whole&nbsp;
game in compilable and editable C++.

00:00:33.120 --> 00:00:35.600
There's still more work as&nbsp;
far as improving the accuracy,&nbsp;&nbsp;

00:00:35.600 --> 00:00:39.840
the portability, and our overall understanding&nbsp;
of everything in it, but the whole game is here.

00:00:39.840 --> 00:00:43.120
You can compile LEGO Island on&nbsp;
your PC from scratch and play&nbsp;&nbsp;

00:00:43.120 --> 00:00:46.400
through it as if it just rolled&nbsp;
off the Mindscape assembly line.

00:00:46.400 --> 00:00:49.600
In just a year and a half, this was one&nbsp;
of the fastest decomps I'm aware of,&nbsp;&nbsp;

00:00:49.600 --> 00:00:52.160
and while I'd love to pretend&nbsp;
that this was all because of me,&nbsp;&nbsp;

00:00:52.160 --> 00:00:55.040
in reality there's no way we would&nbsp;
be talking about this right now if it&nbsp;&nbsp;

00:00:55.040 --> 00:00:58.560
weren't for the immensely dedicated team&nbsp;
that came together around this project.

00:00:58.560 --> 00:01:02.720
Even while I was off making documentaries,&nbsp;
short films, and Wii U gamepad clones,&nbsp;&nbsp;

00:01:02.720 --> 00:01:06.320
the team was keeping the whole thing moving,&nbsp;
and they are really the whole reason it got&nbsp;&nbsp;

00:01:06.320 --> 00:01:09.680
done as quickly as it did, so before we&nbsp;
even begin I want to give a huge shoutout&nbsp;&nbsp;

00:01:09.680 --> 00:01:12.880
and thank you to anyone who contributed&nbsp;
and helped nudge this project along.

00:01:12.880 --> 00:01:18.640
But without further ado, let's get into it, how&nbsp;
did we decompile the entirety of LEGO Island?

00:01:25.120 --> 00:01:28.960
Well if you've seen the first part of this series,&nbsp;
you already kind of know how we did it because&nbsp;&nbsp;

00:01:28.960 --> 00:01:32.720
I explained the process of decompilation&nbsp;
in that video, but just to refresh you...

00:01:32.720 --> 00:01:35.680
The word "decompilation" is a bit of a misnomer.

00:01:35.680 --> 00:01:39.600
It sounds simple, like you're just&nbsp;
undoing the compilation process, but no.

00:01:39.600 --> 00:01:42.080
Decompilation is more like recreating the code&nbsp;&nbsp;

00:01:42.080 --> 00:01:46.080
from scratch until it produces something&nbsp;
as close as possible to the original game.

00:01:46.080 --> 00:01:48.800
Once again, the cake metaphor&nbsp;
is actually pretty fitting.

00:01:48.800 --> 00:01:53.040
You can't "just" decompile something in the&nbsp;
same way you can't "just" unbake a cake.

00:01:53.040 --> 00:01:56.480
But if you spend a long time analyzing the&nbsp;
cake and trying a lot of different things,&nbsp;&nbsp;

00:01:56.480 --> 00:01:58.640
you'll almost certainly eventually produce a&nbsp;&nbsp;

00:01:58.640 --> 00:02:02.160
recipe that's extremely close if&nbsp;
not identical to the original.

00:02:02.160 --> 00:02:04.640
That's, in essence, what decompilation is.

00:02:04.640 --> 00:02:06.880
It's a very long and laborious process,&nbsp;&nbsp;

00:02:06.880 --> 00:02:10.320
it's one of those things that's a lot&nbsp;
more time consuming than difficult.

00:02:10.320 --> 00:02:13.440
Once you've got the process down, it&nbsp;
doesn't really change all that much.

00:02:13.440 --> 00:02:17.760
But you'll be doing it over and over and over&nbsp;
for the better part of a year, if not more.

00:02:17.760 --> 00:02:21.280
It's kind of like going to the gym or learning&nbsp;
a foreign language; if you go in thinking&nbsp;&nbsp;

00:02:21.280 --> 00:02:25.920
you'll be buff or fluent in a few days, or&nbsp;
even a few weeks, you'll be disappointed.

00:02:25.920 --> 00:02:29.120
But if you just do a little bit every single day,&nbsp;&nbsp;

00:02:29.120 --> 00:02:32.720
you'll look back after 6 months or so&nbsp;
and be amazed at how far you've come.

00:02:32.720 --> 00:02:35.120
But that's the kind of mentality&nbsp;
and work ethic you have to have.

00:02:35.120 --> 00:02:38.320
It's a marathon, not a sprint, and&nbsp;
it's not for the faint of heart.

00:02:38.320 --> 00:02:40.400
This is where having a small team helps a lot too.

00:02:40.400 --> 00:02:42.960
These are hobby projects, and sometimes&nbsp;
you'll have free time for them,&nbsp;&nbsp;

00:02:42.960 --> 00:02:46.720
and sometimes you won't, but as long as&nbsp;
someone is around to keep pushing it along,&nbsp;&nbsp;

00:02:46.720 --> 00:02:49.280
then you'll all reach the finish line eventually.

00:02:49.280 --> 00:02:52.800
So if I have any advice for people trying&nbsp;
to start a new decompilation project,&nbsp;&nbsp;

00:02:52.800 --> 00:02:56.000
it's understand that this is likely&nbsp;
a several year-long commitment,&nbsp;&nbsp;

00:02:56.000 --> 00:02:59.200
and also try to find a team that's&nbsp;
just as passionate about it as you are.

00:02:59.200 --> 00:03:01.680
So once you've got those, now what?

00:03:01.680 --> 00:03:03.360
Well as I've said in previous episodes,&nbsp;&nbsp;

00:03:03.360 --> 00:03:06.880
you'll definitely want to use something&nbsp;
like Ghidra or IDA to help you along,&nbsp;&nbsp;

00:03:06.880 --> 00:03:10.240
programs that are specifically designed&nbsp;
to assist in picking apart executables.

00:03:10.240 --> 00:03:12.800
Most of us used Ghidra since&nbsp;
it's free and open source.

00:03:12.800 --> 00:03:16.400
Once again neither of these tools can&nbsp;
produce a working decompilation of a program,&nbsp;&nbsp;

00:03:16.400 --> 00:03:19.920
but what they do provide is a lot of&nbsp;
tools to help you better understand it.

00:03:19.920 --> 00:03:21.680
For example, when you're looking&nbsp;
at a particular function,&nbsp;&nbsp;

00:03:21.680 --> 00:03:24.320
they can provide a pseudocode representation.

00:03:24.320 --> 00:03:27.360
Not real code, but something&nbsp;
that's a lot more human friendly.

00:03:27.360 --> 00:03:30.880
It's not perfect by any means,&nbsp;
but it is usually pretty accurate.

00:03:30.880 --> 00:03:34.240
You may occasionally need to reference the&nbsp;
assembly to really understand what's going on,&nbsp;&nbsp;

00:03:34.240 --> 00:03:37.360
but for simpler functions, it's often&nbsp;
enough to just paste this into your code,&nbsp;&nbsp;

00:03:37.360 --> 00:03:39.760
and clean it up until it's actually compilable.

00:03:39.760 --> 00:03:42.320
As you learn information about the&nbsp;
game, you can provide information&nbsp;&nbsp;

00:03:42.320 --> 00:03:46.640
back to Ghidra or IDA and its results will&nbsp;
steadily improve, helping you even more.

00:03:46.640 --> 00:03:49.120
You'll start to see things you&nbsp;
discovered earlier pop up in&nbsp;&nbsp;

00:03:49.120 --> 00:03:51.520
other places, helping you understand those too.

00:03:51.520 --> 00:03:55.280
If you figure out the type of a variable, it'll&nbsp;
propagate to everywhere else it gets used.

00:03:55.280 --> 00:03:58.320
This cycle continues basically&nbsp;
until the end of the project,&nbsp;&nbsp;

00:03:58.320 --> 00:04:02.560
Ghidra giving you information, you giving&nbsp;
it information, it giving you more until&nbsp;&nbsp;

00:04:02.560 --> 00:04:06.480
hopefully eventually you both have a&nbsp;
pretty complete understanding of it.

00:04:06.480 --> 00:04:08.880
But something we found with the&nbsp;
LEGO Island decomp was that it&nbsp;&nbsp;

00:04:08.880 --> 00:04:11.760
was actually pretty cumbersome&nbsp;
to feed data back into Ghidra.

00:04:11.760 --> 00:04:15.120
Like after hours of work, we'd finally&nbsp;
solve a particular struct or a function,&nbsp;&nbsp;

00:04:15.120 --> 00:04:18.640
just to get extra homework putting all&nbsp;
of that information back into Ghidra.

00:04:18.640 --> 00:04:22.480
Most of us simply never did it, meaning&nbsp;
the Ghidra repository quickly fell behind&nbsp;&nbsp;

00:04:22.480 --> 00:04:25.680
the decompilation itself, becoming&nbsp;
less useful than it should have been.

00:04:25.680 --> 00:04:28.320
So eventually team member jonschz wrote a Ghidra&nbsp;&nbsp;

00:04:28.320 --> 00:04:31.120
script that automatically populated&nbsp;
it with data from the decomp.

00:04:31.120 --> 00:04:35.600
This made it easy to keep the Ghidra repository&nbsp;
up to date so we could maximize its usefulness.

00:04:35.600 --> 00:04:39.760
Funnily enough all of the information started&nbsp;
causing my Ghidra server to run out of memory.

00:04:39.760 --> 00:04:43.120
I had to change its configuration just to&nbsp;
keep it from crashing every couple of days.

00:04:43.120 --> 00:04:46.960
But in a way that's a good thing, we're really&nbsp;
getting as much as we can out of our setup.

00:04:46.960 --> 00:04:48.320
Okay so that’s the refresher,&nbsp;&nbsp;

00:04:48.320 --> 00:04:51.520
that's broadly what's happening&nbsp;
whenever you're decompiling something.

00:04:51.520 --> 00:04:55.200
But how do we know we’re on the&nbsp;
right track and decompiling...

00:04:55.200 --> 00:04:56.000
...good?

00:04:56.000 --> 00:04:58.880
Well, that brings us to the topic of "matching".

00:04:58.880 --> 00:05:02.560
Early on, we all discussed what level of&nbsp;
accuracy we were going for with this decomp.

00:05:02.560 --> 00:05:04.240
There are basically 3 options.

00:05:04.240 --> 00:05:07.040
Byte matching is for those&nbsp;
who are real perfectionists.

00:05:07.040 --> 00:05:09.680
Basically your goal is that&nbsp;
your decomp will compile to&nbsp;&nbsp;

00:05:09.680 --> 00:05:12.800
exactly byte-for-byte the same executable.

00:05:12.800 --> 00:05:16.880
This is obviously the hardest and most labor&nbsp;
intensive option, but there's no debate that&nbsp;&nbsp;

00:05:16.880 --> 00:05:21.600
your code is just as good as the original&nbsp;
source code - I mean, the results confirm it.

00:05:21.600 --> 00:05:23.680
Instruction matching is a step below.

00:05:23.680 --> 00:05:27.680
A program's code is basically just a collection&nbsp;
of functions, and rather than trying to produce&nbsp;&nbsp;

00:05:27.680 --> 00:05:33.440
exactly the same end file, the goal here is that&nbsp;
each function compiles to the same machine code.

00:05:33.440 --> 00:05:35.360
In general, this is a lot more practical than a&nbsp;&nbsp;

00:05:35.360 --> 00:05:38.240
byte match since you’re just trying to&nbsp;
make your code do the same thing rather&nbsp;&nbsp;

00:05:38.240 --> 00:05:42.400
than recreating every single eccentricity&nbsp;
that contributed to a final executable,&nbsp;&nbsp;

00:05:42.400 --> 00:05:47.440
and the result should still play exactly the same&nbsp;
since the code is obviously the important part.

00:05:47.440 --> 00:05:51.360
Finally there's non-matching, though you&nbsp;
can also call it a "functional" match.

00:05:51.360 --> 00:05:55.120
This is where you don't explicitly try to make&nbsp;
the code identical, you may not even write it&nbsp;&nbsp;

00:05:55.120 --> 00:05:59.280
in the same language, you just try to make&nbsp;
sure each function produces the same results.

00:05:59.280 --> 00:06:02.320
You still look at the original code to&nbsp;
see exactly what each function does,&nbsp;&nbsp;

00:06:02.320 --> 00:06:06.400
but if the resulting instructions from your decomp&nbsp;
aren't in quite the right order or aren't using&nbsp;&nbsp;

00:06:06.400 --> 00:06:10.160
exactly the same registers, it's not a big&nbsp;
deal as long as the end results are the same.

00:06:10.160 --> 00:06:11.520
None of these approaches are wrong.

00:06:11.520 --> 00:06:13.280
Done right, they'll all achieve what we want out&nbsp;&nbsp;

00:06:13.280 --> 00:06:16.880
of a decomp - a modifiable codebase that&nbsp;
compiles to one of our favorite games.

00:06:16.880 --> 00:06:21.840
It's just a matter of how perfect you want it to&nbsp;
be vs. how much effort do you want to pour in.

00:06:21.840 --> 00:06:25.680
If you remember, I had first tried to&nbsp;
decompile LEGO Island back in 2019,&nbsp;&nbsp;

00:06:25.680 --> 00:06:29.680
and since I’m a perfectionist, even back then&nbsp;
I was aiming for a byte match, just for the&nbsp;&nbsp;

00:06:29.680 --> 00:06:33.840
satisfaction of knowing this was as close to the&nbsp;
original source code as we could possibly get.

00:06:33.840 --> 00:06:35.920
But this time I was a little more wary.

00:06:35.920 --> 00:06:38.240
I mean, I’d already bitten off&nbsp;
more than I could chew before,&nbsp;&nbsp;

00:06:38.240 --> 00:06:40.880
so I was once again hesitant&nbsp;
to commit to anything big.

00:06:40.880 --> 00:06:44.720
The team that joined after my first video&nbsp;
were also interested in aiming for accuracy,&nbsp;&nbsp;

00:06:44.720 --> 00:06:48.080
but they also knew as much as I did&nbsp;
that this would be an uphill battle,&nbsp;&nbsp;

00:06:48.080 --> 00:06:50.960
so we ultimately decided on a bit of a compromise.

00:06:50.960 --> 00:06:53.520
Helpfully, these approaches&nbsp;
aren’t mutually exclusive,&nbsp;&nbsp;

00:06:53.520 --> 00:06:56.960
you can always start with something&nbsp;
rough and make it more accurate later on.

00:06:56.960 --> 00:07:00.080
So our goal was to aim for instruction&nbsp;
matching whenever possible,&nbsp;&nbsp;

00:07:00.080 --> 00:07:03.440
and then see if we could work our&nbsp;
way up to byte matching later on.

00:07:03.440 --> 00:07:06.000
This wasn’t just for the satisfaction&nbsp;
of getting close to the original,&nbsp;&nbsp;

00:07:06.000 --> 00:07:09.520
there are practical reasons why instruction&nbsp;
matching tends to be good practice.

00:07:09.520 --> 00:07:13.760
Sure you can decompile without it, but&nbsp;
how do you know you got a function right?

00:07:13.760 --> 00:07:18.320
I mean you can stare at them side by side and&nbsp;
be pretty sure you have, but what if you made&nbsp;&nbsp;

00:07:18.320 --> 00:07:22.320
a mistake, or missed something, or thought&nbsp;
something wasn’t important when it was?

00:07:22.320 --> 00:07:25.200
Realistically you can’t be 100% sure,&nbsp;&nbsp;

00:07:25.200 --> 00:07:29.440
unless it actually does exactly the&nbsp;
same thing down to the instruction.

00:07:29.440 --> 00:07:31.120
Matching the instructions is more work,&nbsp;&nbsp;

00:07:31.120 --> 00:07:35.680
but it also gives us the peace of mind that&nbsp;
our code is faithfully recreating the game.

00:07:35.680 --> 00:07:39.040
To help us with this, I wrote a&nbsp;
Python script called "reccmp".

00:07:39.040 --> 00:07:41.920
Basically it does what a lot&nbsp;
of existing decomp tools do,&nbsp;&nbsp;

00:07:41.920 --> 00:07:45.520
which is provide a diff between the&nbsp;
original code and the recompiled code.

00:07:45.520 --> 00:07:48.640
However my tool has a slight&nbsp;
twist that really helped us out.

00:07:48.640 --> 00:07:52.160
Firstly we would have had to write some&nbsp;
tooling anyway because most decomp tools,&nbsp;&nbsp;

00:07:52.160 --> 00:07:56.640
at least at the time, specifically target&nbsp;
old console games, not Windows 95 games.

00:07:56.640 --> 00:08:00.160
We could have just forked something but&nbsp;
I wanted to go a little further with it.

00:08:00.160 --> 00:08:01.680
Above each decompiled function,&nbsp;&nbsp;

00:08:01.680 --> 00:08:05.760
I'd put a little annotation that specified&nbsp;
where in the original file it came from.

00:08:05.760 --> 00:08:08.160
Then, as long as we compiled&nbsp;
with debug symbols enabled,&nbsp;&nbsp;

00:08:08.160 --> 00:08:11.520
it could use those to see where&nbsp;
that function was in our version.

00:08:11.520 --> 00:08:14.000
From there, as long as we kept&nbsp;
those annotations on every function,&nbsp;&nbsp;

00:08:14.000 --> 00:08:17.360
the script could tell us anything&nbsp;
about any function in the project.

00:08:17.360 --> 00:08:20.640
We could use it to get immediate feedback&nbsp;
on how accurate a function was while we&nbsp;&nbsp;

00:08:20.640 --> 00:08:23.920
were working on it, but also since it had&nbsp;
complete knowledge of the entire project,&nbsp;&nbsp;

00:08:23.920 --> 00:08:26.080
we could use it to track the whole thing.

00:08:26.080 --> 00:08:30.240
How much of an impact a particular contribution&nbsp;
had made, if something had caused a regression.

00:08:30.240 --> 00:08:33.840
reccmp became our main feedback&nbsp;
loop and way of measuring progress.

00:08:33.840 --> 00:08:36.960
This is another thing I would really recommend&nbsp;
if you're starting a new decompilation.

00:08:36.960 --> 00:08:40.480
It doesn't have to be reccmp, but find&nbsp;
or create plenty of tooling because&nbsp;&nbsp;

00:08:40.480 --> 00:08:43.920
for such a long project you're going&nbsp;
to need as much help as you can get.

00:08:43.920 --> 00:08:47.200
Over time, team member disinvite&nbsp;
expanded reccmp even further to&nbsp;&nbsp;

00:08:47.200 --> 00:08:50.560
check things like virtual tables,&nbsp;
the stack layout, global data,&nbsp;&nbsp;

00:08:50.560 --> 00:08:54.480
struct sizes (because this compiler is&nbsp;
too old for static assert), and more.

00:08:54.480 --> 00:08:59.360
These too provided a major boost to the decomp&nbsp;
and our ability to track progress and accuracy.

00:08:59.360 --> 00:09:02.880
Everything would have been&nbsp;
perfect, if it hadn't been for...

00:09:08.080 --> 00:09:11.520
Decompiling a game can be as&nbsp;
much a study of the game as it&nbsp;&nbsp;

00:09:11.520 --> 00:09:14.080
is the compiler that the developers used for it.

00:09:14.080 --> 00:09:17.520
Sure it matters what source code went&nbsp;
in, but ultimately the compiler is what&nbsp;&nbsp;

00:09:17.520 --> 00:09:20.720
generated the stuff that you're looking&nbsp;
at, so to get back to the source code,&nbsp;&nbsp;

00:09:20.720 --> 00:09:23.200
you're gonna need to have&nbsp;
an idea of how it did it.

00:09:23.200 --> 00:09:25.120
When it comes to instruction or byte matching,&nbsp;&nbsp;

00:09:25.120 --> 00:09:28.960
you really need to find exactly the same&nbsp;
compiler that was used in the original.

00:09:28.960 --> 00:09:30.400
And I mean exactly.

00:09:30.400 --> 00:09:33.680
There are so many variables when it&nbsp;
comes to what assembly is generated,&nbsp;&nbsp;

00:09:33.680 --> 00:09:38.160
compiler developers are constantly changing things&nbsp;
trying to get more optimal results out of the CPU,&nbsp;&nbsp;

00:09:38.160 --> 00:09:41.280
that realistically your only chance&nbsp;
of even getting close to the same&nbsp;&nbsp;

00:09:41.280 --> 00:09:45.760
binary is starting with the exact same&nbsp;
compiler with exactly the same flags.

00:09:45.760 --> 00:09:48.160
Both of which, you're probably&nbsp;
gonna have to figure out yourself.

00:09:48.160 --> 00:09:51.280
Thankfully, compiler identification&nbsp;
isn't usually too hard.

00:09:51.280 --> 00:09:54.560
They usually leave some kind of metadata&nbsp;
about themselves in the finished program.

00:09:54.560 --> 00:09:59.760
For LEGO Island, Mindscape used&nbsp;
Microsoft Visual C++ 4.2 from 1996,&nbsp;&nbsp;

00:09:59.760 --> 00:10:03.440
and thankfully they appear to have&nbsp;
kept all of the compiler flags stock.

00:10:03.440 --> 00:10:06.480
Unfortunately, even with the&nbsp;
same compiler, the same flags,&nbsp;&nbsp;

00:10:06.480 --> 00:10:12.000
and accurate decompiled code, you&nbsp;
still may not get identical assembly.

00:10:12.000 --> 00:10:12.720
Why?

00:10:12.720 --> 00:10:15.280
Well like any language, there are a&nbsp;
lot of different ways to accomplish&nbsp;&nbsp;

00:10:15.280 --> 00:10:20.000
the same thing in x86 assembly, none of&nbsp;
them necessarily wrong, but different.

00:10:20.000 --> 00:10:24.800
So how does a compiler decide which&nbsp;
one to use? Well in the case of MSVC,&nbsp;&nbsp;

00:10:24.800 --> 00:10:27.520
the short answer seems to be... it doesn't.

00:10:27.520 --> 00:10:29.600
It instead leaves it up to...

00:10:29.600 --> 00:10:30.800
...apparently...

00:10:30.800 --> 00:10:32.000
...RNG.

00:10:32.000 --> 00:10:35.440
Okay, not literal RNG, it&nbsp;
doesn't change every compile.

00:10:35.440 --> 00:10:40.080
What happens is for any given function in a&nbsp;
file, if you make any change to that file,&nbsp;&nbsp;

00:10:40.080 --> 00:10:43.840
including changes that don't affect that&nbsp;
function at all, and including changes in&nbsp;&nbsp;

00:10:43.840 --> 00:10:49.280
any header that's included in that file, MSVC may&nbsp;
pick a different way of compiling that function.

00:10:49.280 --> 00:10:51.680
We've called this phenomenon "compiler entropy".

00:10:51.680 --> 00:10:56.000
It's like it's random, but it uses&nbsp;
the file itself as the random seed.

00:10:56.000 --> 00:10:56.880
Or something?

00:10:56.880 --> 00:10:59.440
We've never really known exactly what causes this.

00:10:59.440 --> 00:11:02.400
We've found a few ways of influencing the entropy,&nbsp;&nbsp;

00:11:02.400 --> 00:11:07.040
adding empty variables or meaningless extra&nbsp;
lines or whatever, but nothing consistent.

00:11:07.040 --> 00:11:11.680
The result is functions will randomly&nbsp;
fluctuate as we keep adding code to the decomp.

00:11:11.680 --> 00:11:16.320
Code that was an identical match before will&nbsp;
randomly drop in accuracy just to go back up&nbsp;&nbsp;

00:11:16.320 --> 00:11:21.040
again later on, even when nothing we've done&nbsp;
should have any impact on that code whatsoever.

00:11:21.040 --> 00:11:24.960
In practice, while we had this whole system&nbsp;
of detecting regressions, it became impossible&nbsp;&nbsp;

00:11:24.960 --> 00:11:29.920
to determine whether a drop in accuracy was&nbsp;
actually a regression or just MSVC shenanigans.

00:11:29.920 --> 00:11:32.720
If a function we're decompiling&nbsp;
is being exceptionally stubborn,&nbsp;&nbsp;

00:11:32.720 --> 00:11:35.440
we have no idea if that's because&nbsp;
we just haven't nailed it yet,&nbsp;&nbsp;

00:11:35.440 --> 00:11:40.400
or MSVC is just choosing an alternate&nbsp;
way to compile otherwise correct code.

00:11:40.400 --> 00:11:44.480
This is the entire reason our&nbsp;
accuracy still isn't 100% to this day.

00:11:44.480 --> 00:11:48.720
We can be reasonably sure every function&nbsp;
is correct, and most of the functions that&nbsp;&nbsp;

00:11:48.720 --> 00:11:54.640
don't match today probably did at some point, but&nbsp;
with every change, some go up, and some go down.

00:11:54.640 --> 00:11:56.960
It's like an endless game of whac-a-mole.

00:11:56.960 --> 00:12:01.600
We're still hoping for that byte accurate decomp&nbsp;
one day, but considering how much code is in here,&nbsp;&nbsp;

00:12:01.600 --> 00:12:06.160
chances are pretty damn slim that one day&nbsp;
they'll all magically lock in at 100%.

00:12:06.160 --> 00:12:09.440
The team is currently attempting various&nbsp;
bruteforcing techniques to try getting&nbsp;&nbsp;

00:12:09.440 --> 00:12:12.880
the accuracy up higher, but who knows&nbsp;
whether this will get us there either.

00:12:12.880 --> 00:12:16.080
Personally I suspect we won't reach&nbsp;
100 without knowing exactly what&nbsp;&nbsp;

00:12:16.080 --> 00:12:18.800
causes the entropy in the first&nbsp;
place, and we'll probably never&nbsp;&nbsp;

00:12:18.800 --> 00:12:22.560
know that without significant reverse&nbsp;
engineering of the compiler itself.

00:12:22.560 --> 00:12:25.200
I can only imagine what the&nbsp;
Microsoft developers were thinking.

00:12:25.200 --> 00:12:29.200
Like should we use the test instruction&nbsp;
in this scenario, or the cmp instruction?

00:12:29.200 --> 00:12:32.680
Should we use the ESI register&nbsp;
for this or the EDI register?

00:12:32.680 --> 00:12:36.640
And they spend a few weeks scribbling all over&nbsp;
the whiteboard, weighing the pros and cons,&nbsp;&nbsp;

00:12:36.640 --> 00:12:39.600
and heavily debating it before&nbsp;
eventually deciding "[censored] it,&nbsp;&nbsp;

00:12:39.600 --> 00:12:41.200
let's just make it choose at random!"

00:12:41.200 --> 00:12:46.160
I mean that's my guess, but hey if you worked&nbsp;
on the Microsoft compiler between 1993 and 1996,&nbsp;&nbsp;

00:12:46.160 --> 00:12:48.800
feel free to shoot me an e-mail and&nbsp;
tell me what the hell you were thinking!

00:12:48.800 --> 00:12:52.640
So despite instruction matching the&nbsp;
whole way, our decompilation is still&nbsp;&nbsp;

00:12:52.640 --> 00:12:57.520
only hovering around 98% accuracy and&nbsp;
probably will for the foreseeable future.

00:12:57.520 --> 00:13:00.480
And honestly, it's not that big of a deal.

00:13:00.480 --> 00:13:02.960
While we'll probably always&nbsp;
hope we can hit 100% one day,&nbsp;&nbsp;

00:13:02.960 --> 00:13:06.000
it's not like we can't do all of&nbsp;
the things we wanted to do already.

00:13:06.000 --> 00:13:10.800
It's merely unsatisfying&nbsp;
to be so close yet so far.

00:13:11.920 --> 00:13:15.040
There is another thing that complicates&nbsp;
our ability to achieve byte accuracy,&nbsp;&nbsp;

00:13:15.040 --> 00:13:18.560
and that's LEGO Island's usage&nbsp;
of third party static libraries.

00:13:18.560 --> 00:13:21.120
That's code that other people have&nbsp;
written and probably sold as product&nbsp;&nbsp;

00:13:21.120 --> 00:13:24.320
to Mindscape, that has then been&nbsp;
incorporated into the main game.

00:13:24.320 --> 00:13:26.640
Most of LEGO Island was developed in-house,&nbsp;&nbsp;

00:13:26.640 --> 00:13:31.520
but it does use a few external libraries for&nbsp;
things like decoding Smacker and FLIC videos,&nbsp;&nbsp;

00:13:31.520 --> 00:13:34.800
and it also utilizes a custom&nbsp;
memory allocator called SmartHeap.

00:13:34.800 --> 00:13:37.760
Functionality-wise, all of these&nbsp;
are pretty easy to replace.

00:13:37.760 --> 00:13:40.560
With modern PCs, we can get away&nbsp;
with the standard memory allocator,&nbsp;&nbsp;

00:13:40.560 --> 00:13:44.000
and there are plenty of open source&nbsp;
libraries for decoding Smacker and FLIC.

00:13:44.000 --> 00:13:46.080
But as far as a byte accurate match goes,&nbsp;&nbsp;

00:13:46.080 --> 00:13:50.000
you're gonna need to find all of these,&nbsp;
and the exact same versions of them too.

00:13:50.000 --> 00:13:51.600
I mean you could decompile them too,&nbsp;&nbsp;

00:13:51.600 --> 00:13:55.040
but since they were real products it's&nbsp;
almost certainly easier to just find them.

00:13:55.040 --> 00:13:56.880
But that's still kind of hard because all of&nbsp;&nbsp;

00:13:56.880 --> 00:13:59.920
this stuff predates deployment&nbsp;
of software over the internet.

00:13:59.920 --> 00:14:02.480
Like these never had download links available,&nbsp;&nbsp;

00:14:02.480 --> 00:14:05.680
back then you would have had to&nbsp;
purchase a CD or floppy disk.

00:14:05.680 --> 00:14:10.400
By scouring through various software archives, I&nbsp;
managed to track down versions of SmartHeap and&nbsp;&nbsp;

00:14:10.400 --> 00:14:13.440
Smacker that were really close, close&nbsp;
enough that they were compatible with&nbsp;&nbsp;

00:14:13.440 --> 00:14:18.640
the rest of the decomp, but not exactly&nbsp;
the right version so not byte accurate.

00:14:18.640 --> 00:14:22.640
The FLIC library eventually was just&nbsp;
decompiled since it was relatively simple,&nbsp;&nbsp;

00:14:22.640 --> 00:14:24.800
but for the rest we're still searching.

00:14:24.800 --> 00:14:28.640
There are more hacky ways that we could&nbsp;
extract the library code from LEGO Island&nbsp;&nbsp;

00:14:28.640 --> 00:14:31.680
and convert it into an object that&nbsp;
can be relinked into our decomp.

00:14:31.680 --> 00:14:36.960
This is useful for byte accuracy, but arguably&nbsp;
isn't really in the spirit of decompilation.

00:14:36.960 --> 00:14:39.280
Like yeah of course you&nbsp;
can repackage machine code,&nbsp;&nbsp;

00:14:39.280 --> 00:14:41.920
but aren't we trying to get&nbsp;
a modifiable codebase here?

00:14:41.920 --> 00:14:44.160
Plus it's not like we'll be able&nbsp;
to use most of these libraries&nbsp;&nbsp;

00:14:44.160 --> 00:14:46.560
for anything other than achieving byte accuracy.

00:14:46.560 --> 00:14:49.200
I mean these are obsolete&nbsp;
libraries for Windows 95,&nbsp;&nbsp;

00:14:49.200 --> 00:14:51.920
we’ll need to replace them&nbsp;
anyway to port to anything else

00:14:51.920 --> 00:14:53.600
So does it really matter?

00:14:53.600 --> 00:14:54.720
No, not really.

00:14:54.720 --> 00:14:58.560
Like I said, none of these are particularly&nbsp;
hard to replace with open source equivalents.

00:14:58.560 --> 00:15:03.760
Once again, it's just for the satisfaction&nbsp;
of getting that byte accurate decomp.

00:15:03.760 --> 00:15:05.520
Okay so let's get into the fun stuff.

00:15:05.520 --> 00:15:07.440
One of the biggest advantages to decompiling&nbsp;&nbsp;

00:15:07.440 --> 00:15:10.000
is the opportunity to port&nbsp;
it to other stuff later on.

00:15:10.000 --> 00:15:13.120
It's been a long term joke on the&nbsp;
channel that one day I'll somehow&nbsp;&nbsp;

00:15:13.120 --> 00:15:16.480
facilitate a port of LEGO Island to&nbsp;
the Wii, and well if I'm gonna do that,&nbsp;&nbsp;

00:15:16.480 --> 00:15:19.520
we're gonna have to find a way to&nbsp;
decouple this from its Windows roots.

00:15:19.520 --> 00:15:21.440
Funnily enough we do know that in the beginning,&nbsp;&nbsp;

00:15:21.440 --> 00:15:24.320
the game was originally&nbsp;
planned to be on Macintosh too.

00:15:24.320 --> 00:15:28.160
A developer even told me there were&nbsp;
early intentions to get it to run in DOS.

00:15:28.160 --> 00:15:32.400
And you can see early on they did put&nbsp;
effort in towards making it cross platform.

00:15:32.400 --> 00:15:35.360
There was this thing they wrote called Thin&nbsp;
Graphics Layer which would have helped to&nbsp;&nbsp;

00:15:35.360 --> 00:15:39.600
abstract from the various platforms they wanted&nbsp;
the game to run on, but at some point those plans&nbsp;&nbsp;

00:15:39.600 --> 00:15:43.600
clearly went out the window and they just&nbsp;
started calling DirectX functions directly.

00:15:43.600 --> 00:15:45.040
This is the real problem.

00:15:45.040 --> 00:15:48.080
The game does make some Windows&nbsp;
system calls but it's fairly basic&nbsp;&nbsp;

00:15:48.080 --> 00:15:51.200
stuff like creating the window and&nbsp;
receiving mouse and keyboard events.

00:15:51.200 --> 00:15:54.240
Things that wouldn't really take too&nbsp;
long to rewrite for another platform.

00:15:54.240 --> 00:15:57.520
DirectX, however, is involved&nbsp;
in almost everything.

00:15:57.520 --> 00:16:00.240
All of the models, all of the&nbsp;
images, all of the textures,&nbsp;&nbsp;

00:16:00.240 --> 00:16:03.120
all of the sound, and all of the controller input.

00:16:03.120 --> 00:16:06.240
And all of that stuff is only on Windows.

00:16:06.240 --> 00:16:09.040
Yes, I know you're saying,&nbsp;
isn't DirectX on the Xbox too?

00:16:09.040 --> 00:16:11.520
And the answer yes, but not this version.

00:16:11.520 --> 00:16:13.520
LEGO Island was written for DirectX 5,&nbsp;&nbsp;

00:16:13.520 --> 00:16:16.640
which is very different from any&nbsp;
version that shipped on an Xbox.

00:16:16.640 --> 00:16:18.240
So basically, there's no way around it.

00:16:18.240 --> 00:16:21.120
Getting LEGO Island onto something&nbsp;
else will require pretty significant&nbsp;&nbsp;

00:16:21.120 --> 00:16:23.600
modifications to port it away from DirectX.

00:16:23.600 --> 00:16:26.240
In the short term, we can use translation layers.

00:16:26.240 --> 00:16:30.800
Early PC ports of Super Mario 64 utilized&nbsp;
code from emulator plugins to translate the&nbsp;&nbsp;

00:16:30.800 --> 00:16:36.080
N64 graphics calls to PC, and even today&nbsp;
most ports use some kind of translation&nbsp;&nbsp;

00:16:36.080 --> 00:16:39.040
layer so they don't have to rewrite&nbsp;
the game's graphics code wholesale.

00:16:39.040 --> 00:16:44.240
The most mature translation layer for&nbsp;
DirectX is a little program called... Wine.

00:16:44.240 --> 00:16:49.840
Wine indeed translates DirectX calls to OpenGL,&nbsp;
and it handles Windows system calls too.

00:16:49.840 --> 00:16:52.480
With some effort, you could&nbsp;
rip code out from Wine and&nbsp;&nbsp;

00:16:52.480 --> 00:16:55.920
stitch it into the game to make&nbsp;
it quote-unquote native OpenGL.

00:16:55.920 --> 00:16:58.640
I mean, as native as those ports of Mario 64 are.

00:16:58.640 --> 00:17:01.760
But this obviously won't help&nbsp;
platforms that don't support OpenGL,&nbsp;&nbsp;

00:17:01.760 --> 00:17:05.040
such as pretty much every console in existence.

00:17:05.040 --> 00:17:08.400
And as I alluded earlier, we're all&nbsp;
perfectionists here, and so work has&nbsp;&nbsp;

00:17:08.400 --> 00:17:14.160
already started towards rewriting vast swaths of&nbsp;
the game to use cross-platform libraries like SDL.

00:17:14.160 --> 00:17:17.200
At the very least, even if SDL isn't&nbsp;
available on certain platforms,&nbsp;&nbsp;

00:17:17.200 --> 00:17:21.360
it's probably still easier to port that&nbsp;
stuff than thirty year old DirectX APIs.

00:17:21.360 --> 00:17:24.640
But this is still an ongoing&nbsp;
process that's really just started,&nbsp;&nbsp;

00:17:24.640 --> 00:17:29.680
and to be honest, one of the&nbsp;
hardest parts is yet to come.

00:17:29.680 --> 00:17:33.600
You may see the "DRM" in this name and think&nbsp;
it stands for "digital rights management".

00:17:33.600 --> 00:17:34.720
Thankfully it doesn't.

00:17:34.720 --> 00:17:37.680
It is true the Italian version&nbsp;
of LEGO Island comes with SecuROM&nbsp;&nbsp;

00:17:37.680 --> 00:17:40.320
but most versions didn't so we&nbsp;
don't need to worry about that.

00:17:40.320 --> 00:17:43.680
In the early days of 3D, there was a lot&nbsp;
of debate about the best ways to do it,&nbsp;&nbsp;

00:17:43.680 --> 00:17:47.120
and one of those debates was&nbsp;
retained mode vs. immediate mode.

00:17:47.120 --> 00:17:49.520
These are convoluted words, but basically it boils&nbsp;&nbsp;

00:17:49.520 --> 00:17:54.240
down to who owns and maintains the&nbsp;
actual 3D objects, you, or DirectX?

00:17:54.240 --> 00:17:57.360
In immediate mode, it's all up to&nbsp;
you, you handle everything and the&nbsp;&nbsp;

00:17:57.360 --> 00:18:00.960
graphics library is really just there to&nbsp;
abstract from the underlying hardware.

00:18:00.960 --> 00:18:03.520
Retained mode behaves a little&nbsp;
more like a game engine.

00:18:03.520 --> 00:18:05.360
You give it model and texture data,&nbsp;&nbsp;

00:18:05.360 --> 00:18:08.960
but the library is what actually&nbsp;
builds and renders the scene.

00:18:08.960 --> 00:18:14.240
Retained mode was therefore significantly easier&nbsp;
to use, but also provided a lot less control.

00:18:14.240 --> 00:18:17.600
If something was running slowly, you&nbsp;
may not necessarily be able to tell why,&nbsp;&nbsp;

00:18:17.600 --> 00:18:21.840
and retained mode could bloat your game with a&nbsp;
lot of functionality that you don't actually need.

00:18:21.840 --> 00:18:24.960
Ultimately nearly all developers&nbsp;
preferred to use immediate mode,&nbsp;&nbsp;

00:18:24.960 --> 00:18:30.480
and retained mode was only seen in a handful&nbsp;
of major commercial releases, like LEGO Island,&nbsp;&nbsp;

00:18:30.480 --> 00:18:34.640
but demand was otherwise so low that&nbsp;
Microsoft deprecated it shortly afterwards.

00:18:34.640 --> 00:18:38.480
It didn't make it into the Xbox and it&nbsp;
didn't even make it into Windows Vista.

00:18:38.480 --> 00:18:43.120
If you've ever opened LEGO Island and seen&nbsp;
this message, that's why, they just removed it.

00:18:43.120 --> 00:18:47.360
Ironically, Microsoft does still support all of&nbsp;
the other DirectX infrastructure from that era,&nbsp;&nbsp;

00:18:47.360 --> 00:18:51.360
so you can just restore the retained&nbsp;
mode DLL and it'll work fine since&nbsp;&nbsp;

00:18:51.360 --> 00:18:54.640
it just sits on top of the immediate&nbsp;
mode stuff that they still support.

00:18:54.640 --> 00:18:59.360
Yeah, it's not that D3DRM was too old or&nbsp;
anything, it was just so underutilized they&nbsp;&nbsp;

00:18:59.360 --> 00:19:02.960
concluded they could just stop shipping&nbsp;
it and most people wouldn't notice.

00:19:02.960 --> 00:19:06.000
Funnily enough, the situation&nbsp;
is pretty similar on Wine.

00:19:06.000 --> 00:19:10.240
They have a D3DRM implementation,&nbsp;
but it's very incomplete and can't&nbsp;&nbsp;

00:19:10.240 --> 00:19:13.760
do much that's useful. But the rest of&nbsp;
the infrastructure is pretty much done,&nbsp;&nbsp;

00:19:13.760 --> 00:19:17.840
so if you restore the original DLL,&nbsp;
you can play LEGO Island mostly fine.

00:19:17.840 --> 00:19:21.680
D3DRM has been the elephant in the&nbsp;
room for most of the decompilation.

00:19:21.680 --> 00:19:25.120
Even as we approached the finish line, we&nbsp;
still knew that a big chunk of the game's&nbsp;&nbsp;

00:19:25.120 --> 00:19:29.040
graphics were not handled by the game, they&nbsp;
were handled by this behemoth of a library.

00:19:29.040 --> 00:19:32.720
LEGO Island is very much&nbsp;
written in the D3DRM ecosystem.

00:19:32.720 --> 00:19:36.080
Porting away from it is difficult because&nbsp;
the only thing that really behaves like it&nbsp;&nbsp;

00:19:36.080 --> 00:19:39.920
is a full blown game engine, which would&nbsp;
likely bring its own baggage with it.

00:19:39.920 --> 00:19:42.720
We could roll our own custom&nbsp;
equivalent library where we&nbsp;&nbsp;

00:19:42.720 --> 00:19:46.160
only have to implement the subset&nbsp;
of features that LEGO Island uses.

00:19:46.160 --> 00:19:48.480
We could also always...

00:19:48.480 --> 00:19:49.520
*sigh*

00:19:49.520 --> 00:19:52.320
...decompile D3DRM as well.

00:19:52.320 --> 00:19:57.200
Then of course we have everything we need and&nbsp;
can more easily port that to other platforms.

00:19:57.200 --> 00:20:00.240
But of course, this is also the&nbsp;
most labor intensive thing to do.

00:20:00.240 --> 00:20:03.360
After decompiling a whole game I'm&nbsp;
not sure any of us are chomping&nbsp;&nbsp;

00:20:03.360 --> 00:20:07.760
at the bit to decompile some obscure&nbsp;
and obsolete DirectX infrastructure.

00:20:07.760 --> 00:20:11.920
On the naughtier end, a substantial&nbsp;
amount of Windows code has...

00:20:11.920 --> 00:20:16.960
...leaked... over the years, including&nbsp;
the complete source code for D3DRM.

00:20:16.960 --> 00:20:20.640
I don't think any of us love the&nbsp;
idea of using leaked Microsoft code.

00:20:20.640 --> 00:20:26.800
I mean decomps are already in a legal grey area,&nbsp;
but LEGO doesn't seem to care and Microsoft...

00:20:26.800 --> 00:20:27.360
...might.

00:20:27.360 --> 00:20:30.880
At this point, there isn't really a&nbsp;
consensus as to what the best approach is.

00:20:30.880 --> 00:20:32.800
All of them seem terrible in their own ways,&nbsp;&nbsp;

00:20:32.800 --> 00:20:38.560
and it's really just a matter of deciding&nbsp;
what the lesser of all these evils are.

00:20:38.560 --> 00:20:42.160
One of the interesting things about interviewing&nbsp;
a lot of different developers for the documentary&nbsp;&nbsp;

00:20:42.160 --> 00:20:45.600
is that some of them still have stuff&nbsp;
that they backed up from the time.

00:20:45.600 --> 00:20:47.520
About six months into the decompilation,&nbsp;&nbsp;

00:20:47.520 --> 00:20:52.480
one of the developers said they might be able to&nbsp;
help me find the real source code to the game,&nbsp;&nbsp;

00:20:52.480 --> 00:20:58.080
as in the final retail code, but only if we&nbsp;
could get official permission from Mindscape.

00:20:58.080 --> 00:21:01.680
I brought this up with the admin team&nbsp;
and there were some very mixed feelings.

00:21:01.680 --> 00:21:05.040
Like obviously having the real source code,&nbsp;
especially if we could somehow officially sanction&nbsp;&nbsp;

00:21:05.040 --> 00:21:09.840
it, would be the best possible thing to work from&nbsp;
and would save us months if not years of time.

00:21:09.840 --> 00:21:11.760
But also... we were on a roll.

00:21:11.760 --> 00:21:15.840
We'd found this incredible team that had banded&nbsp;
together and was making contributions every single&nbsp;&nbsp;

00:21:15.840 --> 00:21:20.480
day to make this a reality, and it felt like&nbsp;
such a shame for that to all just disappear.

00:21:20.480 --> 00:21:23.040
But it would also be unfair to make&nbsp;
them commit so much of their time&nbsp;&nbsp;

00:21:23.040 --> 00:21:26.320
and energy to a project that may&nbsp;
not have a good reason to exist.

00:21:26.320 --> 00:21:30.880
So I decided to look into it, who owns the&nbsp;
copyrights to LEGO Island's source code?

00:21:30.880 --> 00:21:35.360
The answer is actually pretty complicated, and&nbsp;
full disclosure I'm not a copyright lawyer or&nbsp;&nbsp;

00:21:35.360 --> 00:21:39.360
anything, this is just speculation based&nbsp;
on what I've been able to find publicly.

00:21:39.360 --> 00:21:41.200
The obvious answer is LEGO.

00:21:41.200 --> 00:21:43.680
I mean, they clearly own&nbsp;
the brand, the characters,&nbsp;&nbsp;

00:21:43.680 --> 00:21:45.840
and the ability to make more games in the series.

00:21:45.840 --> 00:21:49.600
But whether they own the copyrights&nbsp;
to the game's code is another story.

00:21:49.600 --> 00:21:52.320
LEGO Island utilized a lot of&nbsp;
Mindscape proprietary code,&nbsp;&nbsp;

00:21:52.320 --> 00:21:55.360
including components that were&nbsp;
used both before and after it,&nbsp;&nbsp;

00:21:55.360 --> 00:21:59.040
so at the very least Mindscape must&nbsp;
have retained ownership over that stuff.

00:21:59.040 --> 00:22:02.720
But it would have been fairly complex to tease&nbsp;
apart which parts of LEGO Island's source code&nbsp;&nbsp;

00:22:02.720 --> 00:22:06.480
should belong to LEGO and which parts should&nbsp;
belong to Mindscape, especially since the&nbsp;&nbsp;

00:22:06.480 --> 00:22:10.640
more game-specific stuff would have been pretty&nbsp;
useless without the underlying Mindscape engine.

00:22:10.640 --> 00:22:14.160
Add into this that there probably wasn't&nbsp;
much motivation for LEGO to acquire the code.

00:22:14.160 --> 00:22:17.760
I mean, the idea that you might want to re-release&nbsp;
the game 30 years later wouldn't have even been&nbsp;&nbsp;

00:22:17.760 --> 00:22:21.920
on most peoples' radar at the time, especially&nbsp;
for a company that was brand new to video games.

00:22:21.920 --> 00:22:25.600
It would have been a fairly standard arrangement&nbsp;
for LEGO to have contracted Mindscape to make&nbsp;&nbsp;

00:22:25.600 --> 00:22:30.000
the game for them but let Mindscape retain&nbsp;
whatever trade secrets they used to make it,&nbsp;&nbsp;

00:22:30.000 --> 00:22:32.720
and I highly suspect that's what happened here.

00:22:32.720 --> 00:22:36.640
So if Mindscape retained the code&nbsp;
copyrights, who would have them now?

00:22:36.640 --> 00:22:40.160
Shortly after the release of LEGO Island,&nbsp;
Mindscape was sold to The Learning Company,&nbsp;&nbsp;

00:22:40.160 --> 00:22:42.560
who also purchased Broderbund shortly afterwards.

00:22:42.560 --> 00:22:45.680
The following year, The Learning Company&nbsp;
was purchased by Mattel Interactive,&nbsp;&nbsp;

00:22:45.680 --> 00:22:49.040
in what has been called one of the&nbsp;
worst business deals of all time.

00:22:49.040 --> 00:22:51.280
Mattel, quickly realizing&nbsp;
what a mistake they had made,&nbsp;&nbsp;

00:22:51.280 --> 00:22:55.040
sold their entire interactive division&nbsp;
to the Gores Technology Group.

00:22:55.040 --> 00:22:58.000
Gores split up the assets again,&nbsp;
selling the entertainment stuff&nbsp;&nbsp;

00:22:58.000 --> 00:23:01.520
such as Broderbund's Myst and Prince of&nbsp;
Persia to Ubisoft, and most of the other&nbsp;&nbsp;

00:23:01.520 --> 00:23:05.040
stuff to Riverdeep Interactive, now&nbsp;
known as Houghton Mifflin Harcourt.

00:23:05.040 --> 00:23:07.840
Meanwhile, a former executive of&nbsp;
The Learning Company purchased many&nbsp;&nbsp;

00:23:07.840 --> 00:23:11.200
of their international assets, and&nbsp;
the Mindscape trademark, from Gores.

00:23:11.200 --> 00:23:16.400
He started a new company&nbsp;
called Mindscape in Paris.

00:23:16.400 --> 00:23:20.480
Apart from the name, Mindscape in Paris really&nbsp;
had nothing to do with the Mindscape we know,&nbsp;&nbsp;

00:23:20.480 --> 00:23:23.120
and mostly what they published&nbsp;
was shovelware for the Wii,&nbsp;&nbsp;

00:23:23.120 --> 00:23:26.320
though we don't know exactly what&nbsp;
assets they acquired from Gores.

00:23:26.320 --> 00:23:30.400
After going bankrupt in 2011, their assets&nbsp;
were most likely sold off to shareholders,&nbsp;&nbsp;

00:23:30.400 --> 00:23:33.760
though some offshoots in the Netherlands&nbsp;
and Australia continue to operate,&nbsp;&nbsp;

00:23:33.760 --> 00:23:36.000
but only as glorified storefronts.

00:23:36.000 --> 00:23:41.280
One of these companies most likely is the true&nbsp;
copyright owner of LEGO Island's source code,&nbsp;&nbsp;

00:23:41.280 --> 00:23:45.200
but even they might not be aware of it&nbsp;
since they acquired so many assets in bulk.

00:23:45.200 --> 00:23:48.640
If I was to make a guess, I think it's&nbsp;
most likely Houghton Mifflin Harcourt,&nbsp;&nbsp;

00:23:48.640 --> 00:23:51.760
who also came to acquire Broderbund's&nbsp;
Carmen Sandiego franchise.

00:23:51.760 --> 00:23:53.520
Though apparently they recently sold their media&nbsp;&nbsp;

00:23:53.520 --> 00:23:56.720
division to HarperCollins&nbsp;
so maybe they own it now?

00:23:56.720 --> 00:23:59.920
I tried chasing a few of these leads&nbsp;
but didn't really get anywhere.

00:23:59.920 --> 00:24:03.040
Ubisoft, I highly doubt would&nbsp;
ever entertain this conversation.

00:24:03.040 --> 00:24:06.640
And even though I knew they were several&nbsp;
steps removed from the Mindscape we knew,&nbsp;&nbsp;

00:24:06.640 --> 00:24:09.360
I tried calling the two offshoots to no avail

00:24:09.360 --> 00:24:12.320
The Australian one simply didn't pick up...

00:24:12.320 --> 00:24:17.600
"Thank you for calling Mindscape. The next&nbsp;
available operator will take your call shortly."

00:24:17.600 --> 00:24:20.160
And when I asked the Dutch one&nbsp;
about LEGO Island they responded&nbsp;&nbsp;

00:24:20.160 --> 00:24:26.560
like I just asked about Two Girls One Cup.

00:24:26.560 --> 00:24:28.960
Around this time, the decomp&nbsp;
made a major breakthrough.

00:24:28.960 --> 00:24:36.320
After months of nothing but a blank window, the&nbsp;
team had finally gotten something to appear.

00:24:38.880 --> 00:24:42.800
Okay so it’s a little glitchy but just to&nbsp;
have something appear was a huge milestone,&nbsp;&nbsp;

00:24:42.800 --> 00:24:46.000
and the culmination of a flurry of&nbsp;
activity to implement a substantial&nbsp;&nbsp;

00:24:46.000 --> 00:24:50.800
amount of the game's disk streaming, Smacker&nbsp;
video decoding, sound, and display systems,&nbsp;&nbsp;

00:24:50.800 --> 00:24:54.080
because all of that had to work just&nbsp;
to show something on the screen.

00:24:54.080 --> 00:24:57.920
We call this period “The Advent of Isle”&nbsp;
because it really cemented this decomp as&nbsp;&nbsp;

00:24:57.920 --> 00:25:00.080
something that had a real chance of working out.

00:25:00.080 --> 00:25:03.600
And seeing how the team was making much&nbsp;
better progress than any of my inquiries&nbsp;&nbsp;

00:25:03.600 --> 00:25:07.920
with these companies, I quietly decided to&nbsp;
drop my search and let the decomp continue.

00:25:07.920 --> 00:25:13.280
Over the next year, things proceeded&nbsp;
at the glacial pace that decomps do,&nbsp;&nbsp;

00:25:13.280 --> 00:25:17.680
but every now and then we'd hit a huge milestone&nbsp;
that reminded us of how exciting this was.

00:25:17.680 --> 00:25:19.360
The opening logos and dialogue,

00:25:19.360 --> 00:25:21.840
bitmaps and some cursed facial animation,

00:25:21.840 --> 00:25:23.600
the observation deck, the hospital,

00:25:23.600 --> 00:25:25.280
the first 3D objects to render,

00:25:25.280 --> 00:25:27.120
the first time the whole island rendered,

00:25:27.120 --> 00:25:28.560
the first character animations,

00:25:28.560 --> 00:25:30.320
the first time the lighting actually worked,

00:25:30.320 --> 00:25:32.080
the credits, the first NPCs,

00:25:32.080 --> 00:25:35.200
the first time the pizza missions, the&nbsp;
races, and the build sections worked,

00:25:35.200 --> 00:25:37.680
the first time the game campaign was winnable,

00:25:37.680 --> 00:25:40.080
and eventually, the biggest milestone.

00:25:40.080 --> 00:25:42.320
The point where everything was done.

00:25:42.320 --> 00:25:45.680
Every time we hit a big milestone, I&nbsp;
felt inclined to make another video,&nbsp;&nbsp;

00:25:45.680 --> 00:25:49.920
but in the time it took to write, record,&nbsp;
and edit one, another big milestone happened.

00:25:49.920 --> 00:25:51.920
And then another, and then another.

00:25:51.920 --> 00:25:56.000
It got to a point eventually where I was just&nbsp;
like, may as well wait until the decomp is done.

00:25:56.000 --> 00:25:59.360
And that's obviously what brought us here.

00:25:59.360 --> 00:26:03.120
Something we were able to retrieve&nbsp;
was the first beta to LEGO Island.

00:26:03.120 --> 00:26:06.960
Now there was a beta that had been discovered&nbsp;
before, actually the last beta before the&nbsp;&nbsp;

00:26:06.960 --> 00:26:11.600
final release, but it was so close to the retail&nbsp;
game that it didn't really give us anything new,&nbsp;&nbsp;

00:26:11.600 --> 00:26:15.200
except for a changelog that was mildly&nbsp;
interesting from a historical standpoint.

00:26:15.200 --> 00:26:17.200
Beta 1.0 was different though.

00:26:17.200 --> 00:26:20.880
It was only a month or two earlier and&nbsp;
still largely played like the final game,&nbsp;&nbsp;

00:26:20.880 --> 00:26:25.040
but there were some critical differences&nbsp;
that proved very helpful for the decomp.

00:26:25.040 --> 00:26:28.240
Namely, unlike the other beta,&nbsp;
it had a debug build on it.

00:26:28.240 --> 00:26:31.200
Not a debug build with symbols,&nbsp;
it wasn't that exciting, but it&nbsp;&nbsp;

00:26:31.200 --> 00:26:34.480
still had a lot of information that was&nbsp;
stripped out of the final release builds.

00:26:34.480 --> 00:26:36.560
For one, the code was unoptimized.

00:26:36.560 --> 00:26:39.440
Now if you know anything about&nbsp;
programming in C or C++ you'll&nbsp;&nbsp;

00:26:39.440 --> 00:26:42.400
know that compiler optimizations, as&nbsp;
helpful as they are for performance,&nbsp;&nbsp;

00:26:42.400 --> 00:26:46.320
are a nightmare for debugging code, and&nbsp;
likewise with reverse engineering it.

00:26:46.320 --> 00:26:50.800
You may remember years ago I talked about how&nbsp;
the initial release of Mario 64 was unoptimized,&nbsp;&nbsp;

00:26:50.800 --> 00:26:54.000
and that almost certainly helped&nbsp;
that decompilation succeed.

00:26:54.000 --> 00:26:57.200
Optimizations mean the compiler&nbsp;
has kind of rewritten your code&nbsp;&nbsp;

00:26:57.200 --> 00:26:59.920
to take as much advantage of the CPU as it can.

00:26:59.920 --> 00:27:03.840
As such a lot of things will only vaguely&nbsp;
resemble the original C++ source code,&nbsp;&nbsp;

00:27:03.840 --> 00:27:07.200
which is part of what makes&nbsp;
decompiling as complicated as it is.

00:27:07.200 --> 00:27:11.440
But with unoptimized code, the compiler&nbsp;
has made few if any code modifications,&nbsp;&nbsp;

00:27:11.440 --> 00:27:14.560
it's a much more direct translation&nbsp;
of the source code that went in.

00:27:14.560 --> 00:27:20.480
No unrolled loops or inlined functions, just&nbsp;
whatever the C++ did but in x86 assembly form.

00:27:20.480 --> 00:27:24.400
We'd still compare our decomp with the retail&nbsp;
build since that's what we were trying to remake,&nbsp;&nbsp;

00:27:24.400 --> 00:27:28.960
but the beta gave us a much better picture of what&nbsp;
each function was doing, and was so close to the&nbsp;&nbsp;

00:27:28.960 --> 00:27:33.280
retail release that most of the information from&nbsp;
one would directly translate over to the other.

00:27:33.280 --> 00:27:35.600
Unfortunately, even the unoptimized code was still&nbsp;&nbsp;

00:27:35.600 --> 00:27:38.880
susceptible to compiler entropy&nbsp;
so it wasn't a magic bullet.

00:27:38.880 --> 00:27:41.120
But even so just having the unoptimized code as&nbsp;&nbsp;

00:27:41.120 --> 00:27:44.240
a starting point probably saved&nbsp;
us months of development time.

00:27:44.240 --> 00:27:47.200
Additionally, the debug&nbsp;
build still had assertions.

00:27:47.200 --> 00:27:51.280
Assertions are a common debugging tool&nbsp;
in C and C++ where if you know a certain&nbsp;&nbsp;

00:27:51.280 --> 00:27:54.240
condition should never be the case,&nbsp;
you can have the program immediately&nbsp;&nbsp;

00:27:54.240 --> 00:27:58.000
abort if it does happen so it's then&nbsp;
easy to investigate in a debugger.

00:27:58.000 --> 00:28:02.160
Release builds usually strip them out because,&nbsp;
well, even if something does go wrong in a way&nbsp;&nbsp;

00:28:02.160 --> 00:28:06.880
you don't expect, you don't necessarily want the&nbsp;
program outright crashing itself as a result.

00:28:06.880 --> 00:28:10.800
Assertions commonly have a string that&nbsp;
identifies exactly what went wrong and where,&nbsp;&nbsp;

00:28:10.800 --> 00:28:14.160
and from just seeing these strings in&nbsp;
the code, we'd learn the function name,&nbsp;&nbsp;

00:28:14.160 --> 00:28:18.000
which would often tell us what that code was&nbsp;
supposed to do, the class that it was a part of,&nbsp;&nbsp;

00:28:18.000 --> 00:28:22.160
as well as what was or wasn't supposed to be&nbsp;
happening at that specific point in the code.

00:28:22.160 --> 00:28:24.960
It was the closest thing we could&nbsp;
get to original developer comments&nbsp;&nbsp;

00:28:24.960 --> 00:28:30.000
or documentation, and it too proved invaluable.

00:28:30.000 --> 00:28:34.560
One of the strangest and most frequently discussed&nbsp;
glitches in LEGO Island is the exit crash.

00:28:34.560 --> 00:28:36.160
For reasons that have never been clear,&nbsp;&nbsp;

00:28:36.160 --> 00:28:39.920
trying to exit the game results&nbsp;
everything rapidly losing stability,&nbsp;&nbsp;

00:28:39.920 --> 00:28:44.640
with its animations and sound glitching,&nbsp;
and often the game straight up crashing.

00:28:46.400 --> 00:28:47.840
I mean I guess it gets the job done,&nbsp;&nbsp;

00:28:47.840 --> 00:28:51.040
but you also usually lose all of&nbsp;
your unsaved progress in the process

00:28:51.040 --> 00:28:55.680
This bug is the cause of the infamous&nbsp;
"Are you ready to le?" glitch.

00:29:00.960 --> 00:29:05.040
It happens so frequently nowadays that&nbsp;
it’s actually rarer for it NOT to happen.

00:29:05.040 --> 00:29:09.360
But here's the thing, it doesn't&nbsp;
exist on old versions of Windows.

00:29:09.360 --> 00:29:11.920
There, exiting works exactly as intended,&nbsp;&nbsp;

00:29:11.920 --> 00:29:15.600
without even a hint of the bugginess&nbsp;
you find on WIndows Vista and onwards.

00:29:15.600 --> 00:29:19.600
What Windows change caused such&nbsp;
a stark difference in behavior?

00:29:19.600 --> 00:29:22.960
Even stranger, earlier versions&nbsp;
of the game, like that 1.0 beta,&nbsp;&nbsp;

00:29:22.960 --> 00:29:26.320
used a different frontend written&nbsp;
in MFC, and the exit glitch wasn't&nbsp;&nbsp;

00:29:26.320 --> 00:29:29.760
present with that either, even on&nbsp;
the latest version of Windows 11.

00:29:29.760 --> 00:29:33.520
So it both was and wasn't&nbsp;
caused by updates to Windows?

00:29:33.520 --> 00:29:35.200
What the hell is going on here?

00:29:35.200 --> 00:29:37.520
One of my big hopes for this decompilation is that&nbsp;&nbsp;

00:29:37.520 --> 00:29:40.160
it would reveal the true&nbsp;
cause of this exit glitch.

00:29:40.160 --> 00:29:44.160
I had been able to partially fix it with&nbsp;
patches, but only to stop the game crashing&nbsp;&nbsp;

00:29:44.160 --> 00:29:48.640
and losing your progress, the animation and&nbsp;
audio glitches I never found the solution to.

00:29:48.640 --> 00:29:53.360
Well, I'm incredibly pleased to finally&nbsp;
reveal the cause and solution of this bug.

00:29:53.360 --> 00:29:56.400
There are still some questions about it&nbsp;
that we don’t yet have the answer to,&nbsp;&nbsp;

00:29:56.400 --> 00:29:59.120
but this is what we found&nbsp;
during the decomp process

00:29:59.120 --> 00:30:01.120
This is a function called WndProc.

00:30:01.120 --> 00:30:03.840
It's a standard function you&nbsp;
write when making a Win32 app,&nbsp;&nbsp;

00:30:03.840 --> 00:30:07.840
it's basically the event handler called whenever&nbsp;
Windows needs to send a message to your app.

00:30:07.840 --> 00:30:09.600
WndProc is in the frontend.

00:30:09.600 --> 00:30:12.240
Remember the retail frontend was&nbsp;
completely rewritten from the&nbsp;&nbsp;

00:30:12.240 --> 00:30:14.640
one in the beta that doesn’t exhibit this issue

00:30:14.640 --> 00:30:19.040
Both WndProc’s relay important information back&nbsp;
to the main game, things like mouse movements&nbsp;&nbsp;

00:30:19.040 --> 00:30:24.240
or certain key presses, but do you notice&nbsp;
something kind of odd about the retail WndProc?

00:30:24.240 --> 00:30:27.600
Anything that could potentially be problematic?

00:30:27.600 --> 00:30:31.280
If you said this variable may not&nbsp;
always get initialized, you’re right!

00:30:31.280 --> 00:30:34.400
In some cases it may not, and&nbsp;
there’s no check to ensure it&nbsp;&nbsp;

00:30:34.400 --> 00:30:36.560
has been set before it’s sent over to the backend.

00:30:36.560 --> 00:30:39.600
In C and C++, if you don't&nbsp;
assign a value to a variable,&nbsp;&nbsp;

00:30:39.600 --> 00:30:42.320
then the value in it will be effectively random.

00:30:42.320 --> 00:30:44.080
Well, it will be whatever&nbsp;
was in that memory before,&nbsp;&nbsp;

00:30:44.080 --> 00:30:46.880
which could be anything depending on&nbsp;
what else is running on the system.

00:30:46.880 --> 00:30:49.520
So in some circumstances, the&nbsp;
frontend just ends up sending&nbsp;&nbsp;

00:30:49.520 --> 00:30:53.760
a bunch of random events to the backend,&nbsp;
which wreaks havoc on the exit animation

00:30:53.760 --> 00:30:56.400
The fact that it happens in the&nbsp;
WndProc also explains why moving&nbsp;&nbsp;

00:30:56.400 --> 00:30:59.040
the mouse can make the glitch significantly worse.

00:30:59.040 --> 00:31:02.480
The beta frontend, pre-rewrite, is&nbsp;
written in a way that never sends&nbsp;&nbsp;

00:31:02.480 --> 00:31:06.160
an uninitialized event type to the&nbsp;
backend so it’s never an issue there.

00:31:06.160 --> 00:31:09.040
I’m not sure what necessitated&nbsp;
rewriting the frontend at the&nbsp;&nbsp;

00:31:09.040 --> 00:31:12.880
tail end of development but it’s hardly&nbsp;
surprising this ended up introducing bugs

00:31:12.880 --> 00:31:16.400
If we rework the code in a way that it’ll&nbsp;
never send a random event to the backend,&nbsp;&nbsp;

00:31:16.400 --> 00:31:18.480
the issue magically disappears.

00:31:18.480 --> 00:31:22.400
Though we don’t exactly know yet why the&nbsp;
exit animation is specifically affected,&nbsp;&nbsp;

00:31:22.400 --> 00:31:25.520
or why it mostly happens on&nbsp;
later versions of Windows.

00:31:25.520 --> 00:31:27.840
Paradoxically, even though&nbsp;
we’ve decompiled the whole game,&nbsp;&nbsp;

00:31:27.840 --> 00:31:30.880
that doesn’t mean we have a complete&nbsp;
understanding of the whole game.

00:31:30.880 --> 00:31:35.280
Matching instructions doesn’t require us to&nbsp;
know the purpose or context of a piece of code,&nbsp;&nbsp;

00:31:35.280 --> 00:31:38.720
just that it does certain things&nbsp;
that we try to recreate in C++&nbsp;&nbsp;

00:31:38.720 --> 00:31:41.040
and hopefully it’ll all fit together at the end.

00:31:41.040 --> 00:31:44.160
There’s still a lot we don’t know&nbsp;
and are figuring out as we go,&nbsp;&nbsp;

00:31:44.160 --> 00:31:46.160
and this is definitely one of those things.

00:31:46.160 --> 00:31:51.600
But at least we more or less know the&nbsp;
main culprit and how to fix it now.

00:31:51.600 --> 00:31:55.120
While there were a lot of people who showed up&nbsp;
to contribute to the LEGO Island decomp, if there&nbsp;&nbsp;

00:31:55.120 --> 00:31:59.600
was one person most responsible for bring this&nbsp;
project over the finish line, it was foxtacles.

00:31:59.600 --> 00:32:02.880
Unlike my measly five or so years&nbsp;
of wanting a decomp of this game,&nbsp;&nbsp;

00:32:02.880 --> 00:32:07.520
foxtacles had first thought about&nbsp;
it fifteen years ago in 2009.

00:32:07.520 --> 00:32:10.080
He emerged early on as a major&nbsp;
contributor to the project,&nbsp;&nbsp;

00:32:10.080 --> 00:32:12.800
and he eventually rose up&nbsp;
to join the admin team too.

00:32:12.800 --> 00:32:16.640
Unlike myself, who prefers to bounce around&nbsp;
a number of different projects, foxtacles&nbsp;&nbsp;

00:32:16.640 --> 00:32:21.680
thrived at focusing on one longterm, which is a&nbsp;
fantastic trait to have for a project like this.

00:32:21.680 --> 00:32:24.800
He was really instrumental in&nbsp;
managing the team and diligently&nbsp;&nbsp;

00:32:24.800 --> 00:32:26.480
keeping everything rolling the whole time.

00:32:26.480 --> 00:32:30.080
If it weren't for that I think there's a good&nbsp;
chance this would have stalled a long time ago.

00:32:30.080 --> 00:32:34.880
To be honest, as much as I hate to admit it,&nbsp;
I was kind of the DJ Khaled of this project.

00:32:34.880 --> 00:32:38.480
I wasn't the most talented, at the end of&nbsp;
the day I didn't even contribute the most.

00:32:38.480 --> 00:32:42.720
My biggest contribution was managing to bring&nbsp;
together the right people who could pull this off.

00:32:42.720 --> 00:32:46.560
And pull it off, they did.

00:32:46.560 --> 00:32:49.680
Now that we can compile the entire&nbsp;
game from scratch, I thought it would&nbsp;&nbsp;

00:32:49.680 --> 00:32:54.400
be interesting to build on both a modern&nbsp;
PC and a PC from the era just to compare.

00:32:54.400 --> 00:32:56.400
As a programmer, it's kinda fascinating to have&nbsp;&nbsp;

00:32:56.400 --> 00:32:59.040
the complete source code to&nbsp;
a game you played as a kid.

00:32:59.040 --> 00:33:04.320
Like this is it - this is all the code&nbsp;
behind all those nostalgic experiences I had.

00:33:04.320 --> 00:33:08.560
Back then, LEGO Island felt pretty&nbsp;
big, but today it's undeniably an&nbsp;&nbsp;

00:33:08.560 --> 00:33:12.160
old and primitive codebase compared&nbsp;
to anything we're compiling today.

00:33:12.160 --> 00:33:15.440
So make your bets - how fast&nbsp;
do you think these will finish?

00:33:15.440 --> 00:33:19.200
Let's start out with a Pentium&nbsp;
120 running Windows 95.

00:33:19.200 --> 00:33:22.400
This is my best guess for the kind of&nbsp;
hardware the developers would have actually&nbsp;&nbsp;

00:33:22.400 --> 00:33:27.120
been making LEGO Island with since it came out&nbsp;
in March 1995 just before development started,&nbsp;&nbsp;

00:33:27.120 --> 00:33:31.120
and is listed as the minimum system&nbsp;
requirement for actually playing the game.

00:33:31.120 --> 00:33:33.440
Now I have to speed up this&nbsp;
footage because we clocked&nbsp;&nbsp;

00:33:33.440 --> 00:33:37.440
in at a fairly lengthy 24 minutes and 10 seconds.

00:33:37.440 --> 00:33:39.360
Honestly seeing this really puts into perspective&nbsp;&nbsp;

00:33:39.360 --> 00:33:42.240
how hard it would have been just&nbsp;
to test new code in the game.

00:33:42.240 --> 00:33:45.120
Sure, most of the time you'd only be&nbsp;
recompiling the bit you worked on,&nbsp;&nbsp;

00:33:45.120 --> 00:33:47.760
not the whole thing, but if you were&nbsp;
working on something big enough that&nbsp;&nbsp;

00:33:47.760 --> 00:33:51.760
each time you wanted to test it it had to&nbsp;
recompile even just 20% of the codebase,&nbsp;&nbsp;

00:33:51.760 --> 00:33:55.200
that's a pretty significant chunk of&nbsp;
time you'd have to be sitting around for.

00:33:55.200 --> 00:33:58.320
Now let's do the exact same thing on a modern PC.

00:33:58.320 --> 00:33:59.280
This is my main system.

00:33:59.280 --> 00:34:03.280
It's an i9 13900K and we're&nbsp;
running it through Wine because...

00:34:03.280 --> 00:34:04.800
...this is a Linux household.

00:34:04.800 --> 00:34:10.720
On here, the compile comes out to just 43 seconds,&nbsp;
a pretty huge improvement - well under a minute.

00:34:10.720 --> 00:34:12.640
But wait, this is an old compiler.

00:34:12.640 --> 00:34:14.640
Nearly 30 years old in fact.

00:34:14.640 --> 00:34:17.200
It's lacking decades of technological innovation,&nbsp;&nbsp;

00:34:17.200 --> 00:34:21.040
optimizations, and most importantly&nbsp;
only allows single threaded builds.

00:34:21.040 --> 00:34:23.040
What would happen if we used a modern compiler&nbsp;&nbsp;

00:34:23.040 --> 00:34:28.160
like GCC and compiled across&nbsp;
all 32 threads of this CPU?

00:34:35.680 --> 00:34:41.360
Just over 7 and a half seconds using&nbsp;
a modern compiler on modern hardware!

00:34:41.360 --> 00:34:42.880
That's just mindblowing to me.

00:34:42.880 --> 00:34:47.200
The entirety of LEGO Island, the entire&nbsp;
year-and-a-half-long decompilation,&nbsp;&nbsp;

00:34:47.200 --> 00:34:50.320
all of that code behind all&nbsp;
of those childhood memories...

00:34:50.320 --> 00:34:54.480
...all of it comes together today&nbsp;
in only 7 and a half seconds.

00:34:54.480 --> 00:34:57.360
Part of me thinks decompiling&nbsp;
games is worth it just for this.

00:34:57.360 --> 00:35:00.240
Just to see exactly what went into these games.

00:35:00.240 --> 00:35:04.720
Just to see how far we've come.

00:35:04.720 --> 00:35:08.960
After releasing the LEGO Island documentary,&nbsp;
which itself was shortly after the decompilation&nbsp;&nbsp;

00:35:08.960 --> 00:35:12.080
completed, a LEGO employee reached&nbsp;
out to me asking if I could help&nbsp;&nbsp;

00:35:12.080 --> 00:35:15.600
them find more LEGO Island development&nbsp;
material for their internal archives.

00:35:15.600 --> 00:35:17.600
I sent them some stuff that&nbsp;
I'd obtained over the years,&nbsp;&nbsp;

00:35:17.600 --> 00:35:20.800
and pointed them in the direction of&nbsp;
where they might be able to find more.

00:35:20.800 --> 00:35:24.320
Well, wouldn't you know it, a little&nbsp;
later on I was told that they had&nbsp;&nbsp;

00:35:24.320 --> 00:35:31.920
actually managed to find what seems to be&nbsp;
a copy of the final retail source code...

00:35:31.920 --> 00:35:33.520
...and no, we can't have it.

00:35:33.520 --> 00:35:36.720
It's incredibly ironic that part of&nbsp;
the reason I started the decomp all&nbsp;&nbsp;

00:35:36.720 --> 00:35:40.720
those years ago was because we had all&nbsp;
assumed the source code was lost forever,&nbsp;&nbsp;

00:35:40.720 --> 00:35:44.560
and only after the decomp is finished&nbsp;
does someone actually find a copy.

00:35:44.560 --> 00:35:48.240
Does this mean we're going to see an official&nbsp;
remaster or re-release any time soon?

00:35:48.240 --> 00:35:50.240
Well, it's impossible to say.

00:35:50.240 --> 00:35:54.080
This was merely a single employee's effort&nbsp;
to improve LEGO's internal archives,&nbsp;&nbsp;

00:35:54.080 --> 00:35:57.040
not a company-wide push to do anything with it.

00:35:57.040 --> 00:35:59.920
Things like this don't happen overnight;&nbsp;
they would have to weigh up how well it&nbsp;&nbsp;

00:35:59.920 --> 00:36:03.040
would sell vs. how much it would&nbsp;
cost to get it into better shape,&nbsp;&nbsp;

00:36:03.040 --> 00:36:07.840
negotiate any necessary licenses involved...&nbsp;
all before any actual work would begin.

00:36:07.840 --> 00:36:12.240
But hey if they ever do decide to do that and&nbsp;
need some help, I know some people who are already&nbsp;&nbsp;

00:36:12.240 --> 00:36:18.480
familiar with the code and what would need to be&nbsp;
done to make it more compatible with modern PCs!

00:36:18.480 --> 00:36:23.600
So we made it - LEGO Island has been decompiled,&nbsp;
and we can do whatever we want with this code now.

00:36:23.600 --> 00:36:26.800
There's still a lot to do as far as making&nbsp;
it easier to work with and more portable,&nbsp;&nbsp;

00:36:26.800 --> 00:36:29.760
and if you want to help out with that I'm&nbsp;
sure the team would love to hear from you.

00:36:29.760 --> 00:36:32.560
Already I can see people starting&nbsp;
to attempt ambitious things with it,&nbsp;&nbsp;

00:36:32.560 --> 00:36:36.000
and honestly that's what makes me most&nbsp;
excited about decomps in the first place.

00:36:36.000 --> 00:36:38.560
I can't wait to see what people end&nbsp;
up doing with this in the future.

00:36:38.560 --> 00:36:41.280
This will probably be the last LEGO&nbsp;
Island video I make for a while,&nbsp;&nbsp;

00:36:41.280 --> 00:36:43.520
I mean if there's another big&nbsp;
milestone I'll probably cover it,&nbsp;&nbsp;

00:36:43.520 --> 00:36:46.640
either here or on my second channel, but&nbsp;
otherwise there are a lot of things I'd&nbsp;&nbsp;

00:36:46.640 --> 00:36:50.640
like to start working on and making videos about&nbsp;
that I've been kind of putting off until now.

00:36:50.640 --> 00:36:54.160
If you're interested in more LEGO Island&nbsp;
content, I did release a feature length&nbsp;&nbsp;

00:36:54.160 --> 00:36:57.040
documentary a few months ago where I&nbsp;
interviewed nearly all of the people who&nbsp;&nbsp;

00:36:57.040 --> 00:37:01.120
worked on it and visited key locations like the&nbsp;
old Mindscape offices where the game was made.

00:37:01.120 --> 00:37:04.800
And on my second channel, we just covered&nbsp;
the resurgence of LEGO Island speedrunning,&nbsp;&nbsp;

00:37:04.800 --> 00:37:07.920
featuring discoveries you can only&nbsp;
make by playing the game over and over,&nbsp;&nbsp;

00:37:07.920 --> 00:37:10.080
not just staring at the code like we do.

00:37:10.080 --> 00:37:15.120
But after all that, I think I'm due for a break&nbsp;
from thinking about this game for children.

00:37:15.120 --> 00:37:17.440
Finally I'd like to give a bit&nbsp;
of an update on the channel,&nbsp;&nbsp;

00:37:17.440 --> 00:37:21.920
I'm sure some of you are wondering why have I've&nbsp;
only released like 4 videos in the last two years.

00:37:21.920 --> 00:37:25.440
I hadn't wanted that to be the case,&nbsp;
it just kind of worked out that way.

00:37:25.440 --> 00:37:28.000
Last year especially, the videos&nbsp;
I put out were just really big,&nbsp;&nbsp;

00:37:28.000 --> 00:37:32.960
like the dotnet95 video took 4 months to make,&nbsp;
the LEGO Island documentary took like 6...

00:37:32.960 --> 00:37:36.960
But I've really missed having more of a back&nbsp;
and forth with you guys, like I love working on&nbsp;&nbsp;

00:37:36.960 --> 00:37:40.640
these bigger projects, I love working on these&nbsp;
bigger videos, but I don't love disappearing,&nbsp;&nbsp;

00:37:40.640 --> 00:37:45.440
you know, I wanna try getting back to&nbsp;
putting out stuff semi-regularly again.

00:37:45.440 --> 00:37:48.240
The idea was I would post really&nbsp;
quick updates on Patreon and then&nbsp;&nbsp;

00:37:48.240 --> 00:37:51.120
release bigger videos once projects&nbsp;
were done, but everything has just&nbsp;&nbsp;

00:37:51.120 --> 00:37:54.880
taken longer than I expected so I wanna&nbsp;
look at trying a different approach.

00:37:54.880 --> 00:37:58.800
I'm still figuring out exactly how it's gonna&nbsp;
work work because the reality is my projects&nbsp;&nbsp;

00:37:58.800 --> 00:38:02.560
have just grown a lot in scope, you know, I'm&nbsp;
no longer just replacing a couple capacitors&nbsp;&nbsp;

00:38:02.560 --> 00:38:06.400
on a board and making a whole video about it,&nbsp;
I'm doing decomps, and reverse engineering,&nbsp;&nbsp;

00:38:06.400 --> 00:38:10.640
and writing apps from scratch, and&nbsp;
occasionally making a full-blown documentary,&nbsp;&nbsp;

00:38:10.640 --> 00:38:15.840
and all of that stuff takes months if not&nbsp;
years, not a couple of days like it used to.

00:38:15.840 --> 00:38:18.480
So it may take some time to find the&nbsp;
right balance between doing all these&nbsp;&nbsp;

00:38:18.480 --> 00:38:22.880
bigger projects and still putting out&nbsp;
semi-regular videos that I'm proud of,&nbsp;&nbsp;

00:38:22.880 --> 00:38:27.040
but ultimately I think talking about this stuff is&nbsp;
better than not, so it's something I want to try.

00:38:27.040 --> 00:38:29.440
Anyways with that being said, I&nbsp;
hope you all enjoyed this video,&nbsp;&nbsp;

00:38:29.440 --> 00:38:33.200
and I'll see you all hopefully&nbsp;
pretty soon. Bye guys.

00:38:33.760 --> 00:38:36.560
Just before you go, I want to give a&nbsp;
big shout out to my Patrons and YouTube&nbsp;&nbsp;

00:38:36.560 --> 00:38:39.520
Members who help this channel operate&nbsp;
without sponsors and allow me to spend&nbsp;&nbsp;

00:38:39.520 --> 00:38:42.240
time working on bigger projects&nbsp;
and videos just like this one.

00:38:42.240 --> 00:38:44.720
If you'd like to support and&nbsp;
see both bonus content and main&nbsp;&nbsp;

00:38:44.720 --> 00:38:50.640
channel videos early, considering signing up at&nbsp;
patreon.com/mattkc or youtube.com/mattkc/join.

00:38:50.640 --> 00:39:06.560
Links in the description.

