Building Supermodel on Windows with Visual Studio 2008

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Batman2509 » Tue May 24, 2016 4:21 pm

juhuu,
got the Audio Fixed Version myself sorted with later tips in this thread.
here is the Link for the 32 and 64 Bit Version of R421:
https://mega.nz/#!OwcETRqb!oigwIimas9x8 ... bERQJnK5cA
Batman2509
 
Posts: 31
Joined: Tue Mar 29, 2016 2:40 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby djcc » Sun Sep 10, 2017 1:41 pm

Hi,

I was interested in looking at Supermodel's code so I thought I'd try to build it with the Visual Studio 2017 Community edition I had installed. It actually didn't take much effort to get it working. :)

After copying SDL and zlib, I opened the Visual Studio 2008 solution in Visual Studio 2017. It converted with no problems. When building I encountered an ambiguous symbol error for the "data" variable in the initialize_globals function in audio.cpp. I don't know why the compiler was giving me that error since it was only really seeing the declaration and its extern, but I figured it was clashing with another "data" variable somewhere. I renamed it ("getbits_data"), fixed up the affected areas and then it compiled and ran no problems.

thanks!
djcc
djcc
 
Posts: 2
Joined: Sun Sep 10, 2017 11:53 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Bart » Sun Sep 10, 2017 2:47 pm

djcc wrote:Hi,

I was interested in looking at Supermodel's code so I thought I'd try to build it with the Visual Studio 2017 Community edition I had installed. It actually didn't take much effort to get it working. :)

After copying SDL and zlib, I opened the Visual Studio 2008 solution in Visual Studio 2017. It converted with no problems. When building I encountered an ambiguous symbol error for the "data" variable in the initialize_globals function in audio.cpp. I don't know why the compiler was giving me that error since it was only really seeing the declaration and its extern, but I figured it was clashing with another "data" variable somewhere. I renamed it ("getbits_data"), fixed up the affected areas and then it compiled and ran no problems.

thanks!
djcc


Has anyone else encountered this? If so, perhaps we could incorporate this into the code as a patch?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Kacperas » Sun Sep 10, 2017 9:32 pm

I've reported this problem almost year and half ago.
Kacperas
 
Posts: 42
Joined: Tue Sep 27, 2011 9:35 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Bart » Sun Sep 10, 2017 9:36 pm

Kacperas wrote:I've reported this problem almost year and half ago.


I don't use MSVC. I wonder how Ian is compiling this? Is this an issue that is only present with the latest VS2017? If so, can you submit a patch with your solution of adding the anonymous namespace ::? I can easily apply that.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Kacperas » Sun Sep 10, 2017 10:22 pm

Bart wrote:
Kacperas wrote:I've reported this problem almost year and half ago.


I don't use MSVC. I wonder how Ian is compiling this? Is this an issue that is only present with the latest VS2017? If so, can you submit a patch with your solution of adding the anonymous namespace ::? I can easily apply that.

AFAIK he's using VM2013, which isn't affected by this issue. Only VM2015 and (it seems) newer are.
Regarding patch, I've switched to MSYS more like a year ago, so I no longer use any VM version. Maybe someone else can provide a patch?
Kacperas
 
Posts: 42
Joined: Tue Sep 27, 2011 9:35 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Spindizzi » Mon Sep 11, 2017 12:25 am

Hi,
I think you talk about this
https://yadi.sk/d/gS0L40YX3MmvmF
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Building Supermodel on Windows with Visual Studio 2008

Postby Ian » Mon Sep 11, 2017 9:12 am

It builds fine in visual studio 2013. I think the error in vs2015 is the same.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby MetalliC » Wed Sep 13, 2017 3:17 pm

here is fix for vs2015 and newer
Code: Select all
Index: audio.cpp
===================================================================
--- audio.cpp   (revision 648)
+++ audio.cpp   (working copy)
@@ -190,7 +190,7 @@
  */
 void initialise_globals(void)
 {
-   append=data=nch=0;
+   append=::data=nch=0;
         f_bdirty=TRUE;
         bclean_bytes=0;
 
Index: huffman.cpp
===================================================================
--- huffman.cpp   (revision 648)
+++ huffman.cpp   (working copy)
@@ -47,12 +47,12 @@
 {
 unsigned int pos,ret_value;
 
-        pos = data >> 3;
+        pos = ::data >> 3;
         ret_value = buffer[pos] << 24 |
                     buffer[pos+1] << 16 |
                     buffer[pos+2] << 8 |
                     buffer[pos+3];
-        ret_value <<= data & 7;
+        ret_value <<= ::data & 7;
         ret_value >>= 32 - n;
 
         return ret_value;
@@ -60,8 +60,8 @@
 
 static inline void sackbits(int n)
 {
-        data += n;
-        data &= 8*BUFFER_SIZE-1;
+        ::data += n;
+        ::data &= 8*BUFFER_SIZE-1;
 }
 
 /* huffman_decode() is supposed to be faster now
@@ -228,8 +228,8 @@
    /*  set position to start of the next gr/ch
     */
     if (cnt != info->part2_3_length[gr][ch] - ssize ) {
-       data-=cnt-(info->part2_3_length[gr][ch] - ssize);
-       data&= 8*BUFFER_SIZE - 1;
+       ::data-=cnt-(info->part2_3_length[gr][ch] - ssize);
+       ::data&= 8*BUFFER_SIZE - 1;
     }
    if (l<576) non_zero[ch]=l;
    else non_zero[ch]=576;
Index: layer2.cpp
===================================================================
--- layer2.cpp   (revision 648)
+++ layer2.cpp   (working copy)
@@ -74,7 +74,7 @@
 
    /* layers 1 and 2 do not have a 'bit reservoir'
     */
-   append=data=0;
+   append=::data=0;
 
    fillbfr(mean_frame_size + header->padding_bit - hsize);

speaking in general - having variable "data" in .h file looks evil...
MetalliC
 
Posts: 20
Joined: Wed Jul 09, 2014 2:10 am

Re: Building Supermodel on Windows with Visual Studio 2008

Postby djcc » Sat Sep 16, 2017 2:30 pm

From what I can see, "data" and the other accompanying variables should really belong in the cpp file. But maybe there's a reason it's that way.
djcc
 
Posts: 2
Joined: Sun Sep 10, 2017 11:53 am

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 0 guests