Episode: 1324
Title: HPR1324: Porting Mega Happy Sprite To Windows 
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1324/hpr1324.mp3
Transcribed: 2025-10-17 23:33:57

---

so
I love you, I love you
I love you, I love you
I love you, I love you
I love you, I love you
My happy sprite is a sprite editor that I wrote some while ago, like in 2009
So a good number of years ago, it's a sprite editor for the Psychogenesis
It doesn't run on the Psychogenesis, it just makes sprites for use on the Psychogenesis
It runs natively on Unix systems
But I ported it to Windows about a year ago because of popular demand
What I used to build a Windows program is the Ming W32 build environment
That is for Unix
I tried installing Ming W32 on OpenVSD and Linux and build miserably
But I got working on FreeBSD, so that's good
I'll talk about how to get working on FreeBSD
First thing I want to do is install some ports
Go to a slash user, slash ports, slash double
And that you'll see some sub-directories called Ming W32-asterit
And so you want to install, make install Ming W32-Bin-MSVCRT
Ming W32-Bin-Utiles
Ming W32-GCC
Ming W32-Pthreads
And finally, Ming W32-ZLIM
Those are all the, we're not using open SSL or anything fancy, those are
Just the Pthreads and ZLIMID primarily
And the actual build environment we're using to build mega-happy sprite
Mega-happy sprites will depend on the LibSDL
And I'll talk about how to install LibSDL in a moment
Once you've made and made installed those programs
You'll see that it populated a directory called slash user, slash local, slash Ming W32
And in that directory, you have sub-directories, BIN
For instance, Lib and Include
What we want to do is, mostly I don't know where to bin, see what's the side of it
You can see that all the standard development tools are there
R as CPP, GCC, LD, Object Copy, Object Dump, ForenLib, ReadAlpha, and so on
Strings and Strip
And a couple of new ones that you're not familiar with, WingDMC
WingD Res, I'll talk about those in a bit
So I'm mostly on over the LibDirectory
And you see a bunch of libraries, these libraries are what you're going to be linking against
They're not ELF archives, rather they're cough archives
The library format that we're going to be using
For Ming W32s is cough
So yeah, these libraries get linked specifically with the Ming 32
BINY TILs and GCC
And then, mostly on over to the Include directory, these are all the inclusion files
with definitions and whatnot for various windowy things
Like, Windows, Windows, SX, and WinAir and so on
So this is the complete environment here
This is the complete make environment right here, this is everything you need
Except for libSDL
We want to add libSDL to this
So I'm mostly on over to libSDL.org and go to the Download section
You'll see the Wii Bottom
Development Libraries, Win32
What you want to download is STL-double-version number
www.tarr.gz
So go ahead and download this and uncompress it
You'll see it creates a nice little directory for you, STL-version number
And in it you'll see some familiar things, you'll see a slash BIN
That's cool, you'll see a slash lib and slash include
What you want to do is copy everything in slash BIN
And include and lib
BIN is not also necessary, but it helps
To have that copy as well, just so you know where the BIN files are
The only thing that BIN really includes is STL can big
And we're not using STL for big, so it's not really necessary
It does include a runtime library
You might be familiar if you're familiar with Windows
That DLL files, this contains STL.DLL
Which you'll need in your runtime environment
So again, go ahead and copy those files
BIN, lib, and include into slash user, slash local, slash MING
W32, BIN, info, and ink directories
We're almost done now, what we need now is
STL image, some was added over the STL website again
Again, that's a lib, STL.org
And go to libraries and search for STL image
What you want to do is go to the website
Which is ugly, really ugly
And download STLimage-double-versionnumber-bc.zip
And once you have unzip that
You'll see that it creates
A directory called STL underscore image-versionnumber
In that directory, you'll see include in lib
Which is awesome, that's the two things you want
In lib you have a sub directory.x86
Copy, STLimage.lib
From that to your user slash local
MING W32 slash lib
And copy the include files as well
And then your set, we have a complete make environment for MING W
32
So what you want to do is run it and use it
Which is pretty straightforward
Instead of typing GCC, you type MING W32-GCC
And it should create a program for you
So now that we've got a MING W32 environment
And filing environment, I'll set up
Actually porting
My experience porting MING W32-GCC was actually pretty trivial
My MING W32-GCC doesn't depend on Unix domain sockets
Or anything that's obviously units
It's pretty straightforward
Just depending on STL
Which is ported to windows
All I really did was modify my MING file
If you download the source from MING W32-GCC
You'll notice that there are two MING files
There's one you just call MING file
And there's another one called MING file that windows
I just pretty much changed the environment variable CC to MING W32-GCC
And that's about it
Including some of the libraries
I'll let you know with the libraries we have to include
If you want to make an STL application
There are a few that you need to include
First of all, you need to define MING
And there's a variable they're called MING
So you dash capital D main equals STL main
And then you want to specify dash M windows
I believe this is for architecture
Which happens to be windows
And then you want to link against MING W32
The MING W32 library
So that would be dash L MING W32
And then the user 32 library
The GDI32 library
And then MM library
The DXG UID library
And then STL main
STL and STL image libraries
And so yeah
There's a couple of things
That this does
It produces a mega dot EXC file
Instead of just a mega out file
That is directly
You can run that on a windows computer
I happen to
Generate the mega dot EXC files
And to a directory
Called windows
Where I have those files
That I was talking about
STL.DLL
And STL image.DLL
And look JPEG.DLL
And that's it
Those library files that I was talking about
I actually get packaged with the run time
With the actual program file
And so windows will use those dynamic libraries
If they're in the same directory
And so it's good to package stuff
With those libraries
You don't necessarily have to
You can hope that people have the libraries
But chances are they don't
So it's good to package those things
With the binary
The couple of things
I had to look out for was
There is no real path
On windows
Real path being a
Particularly library call
That's converts a path
Like
Slash mega
Slash dot
Slash cons
To plain old slash cons
And so I had to replace that
And that's about it
I had to modify my
Loader to deal with the
Slashes that go the other way
And that's it
Like there wasn't really much to
Deporting this
So you notice that there's mega
That Ico in the mega happy
Sprite service code file
That happens to be the actual icon file
You can save that with begin
Begin below and save those files
And then what you need to do
Is edit mega rc
And have the
ID icon mega dot Ico
In there to identify
That there is an icon
In the red script
After that you want to run
Ming W32 dash
Wind res, wind res
To generate a res
Cop file
You do that with these arguments
Wind res, mega dot RC
Dash O
Cop
Dash of a lowercase O
That was a capital O before
Mega dot res
And then you can link against mega dot res
As you would a regular object file
And that includes your
Your icon
And let's see here
What else
What else
I believe that's it
So the hard part was getting the
Make environment all set up
The easy part was actually
Parting it
So I hope you guys have fun
Parting the programs to windows
What are you crazy people
On Linux we don't want to
Deal with windows
But you know some people do
And some people don't
So it's not for everyone
Just if you want to have your windows
Program to working on windows
You can definitely do it
In a Unix environment
So take care everyone
And happy hacking
Bye bye
You have been listening to HackerPublic Radio
At HackerPublicRadio.org
We are a community podcast network
The releases shows every week day
On day through Friday
Today's show, like all our shows
Was contributed by a HPR listener
Like yourself
If you ever consider recording a podcast
Then visit our website to find out
How easy it really is
HackerPublic Radio was founded
By the digital dog pound
And the infonomicum computer cloud
HPR is funded by the binary revolution
At binref.com
All binref projects
Are proudly sponsored by luna pages
From shared hosting
To custom private clouds
Go to luna pages.com
For all your hosting needs
Unless otherwise stasis
Today's show is released on the
Creative Commons
Attribution
Share a line
www.HackerPublic Radio
