Giter VIP home page Giter VIP logo

Comments (7)

sezero avatar sezero commented on June 19, 2024

Well, the file hits end-of-file during in the middle of sample reading
in SL_LoadInternal() at
https://github.com/sezero/mikmod/blob/master/libmikmod/playercode/sloader.c#L297

I don't know whether I can do anything about it. @AliceLR: Can you think
of any better solution than the existing one?

from mikmod.

sezero avatar sezero commented on June 19, 2024

FWIW, here are the debug lines I added:

diff --git a/libmikmod/playercode/sloader.c b/libmikmod/playercode/sloader.c
index 4c52ab0..e135403 100644
--- a/libmikmod/playercode/sloader.c
+++ b/libmikmod/playercode/sloader.c
@@ -234,7 +234,7 @@ static int SL_LoadInternal(void *buffer,UWORD infmt,UWORD outfmt,int scalefactor
 	SBYTE compressionTable[16];
 	SWORD adpcmDelta = 0;
 	BOOL hasTable = 0;
-
+fprintf(stderr, "SL_LoadInternal: length==%lu (at %ld)\n",length,reader->Tell(reader));
 	status.buf = 0;
 	status.last = 0;
 	status.bufbits = 0;
@@ -282,7 +282,7 @@ static int SL_LoadInternal(void *buffer,UWORD infmt,UWORD outfmt,int scalefactor
 			}
 		} else {
 			if(infmt&SF_16BITS) {
-				if(_mm_eof(reader)) {
+				if(_mm_eof(reader)) {fprintf(stderr, "SL_LoadInternal(%d): EOF, length==%lu at %ld\n",__LINE__,length,reader->Tell(reader));
 					_mm_errno=MMERR_NOT_A_STREAM;/* better error? */
 					return 1;
 				}
@@ -294,7 +294,7 @@ static int SL_LoadInternal(void *buffer,UWORD infmt,UWORD outfmt,int scalefactor
 				SBYTE *src;
 				SWORD *dest;
 
-				if(_mm_eof(reader)) {
+				if(_mm_eof(reader)) {fprintf(stderr, "SL_LoadInternal(%d): EOF, length==%lu at %ld\n",__LINE__,length,reader->Tell(reader));
 					_mm_errno=MMERR_NOT_A_STREAM;/* better error? */
 					return 1;
 				}

... and it reports:

SL_LoadInternal: length==2476 (at 13001)
SL_LoadInternal: length==1060 (at 15477)
SL_LoadInternal: length==2434 (at 16537)
SL_LoadInternal: length==5346 (at 18971)
SL_LoadInternal: length==3470 (at 24317)
SL_LoadInternal: length==4024 (at 27787)
SL_LoadInternal: length==2764 (at 31811)
SL_LoadInternal: length==800 (at 34575)
SL_LoadInternal: length==8906 (at 35375)
SL_LoadInternal(297): EOF, length==714 at 43375

(Worthy of note is that commit 3a8d364 failed to add the same EOF checks
to the SF_ADPCM4 case at line 267.)

from mikmod.

sezero avatar sezero commented on June 19, 2024

@AliceLR: Do you have any possible solutions? Or should I close this as wontfix?

from mikmod.

Baguettedood avatar Baguettedood commented on June 19, 2024

Ultimately it seems like the file only played because two bugs cancelled each other out 😅

The Onlink devs are fixing the file in the next version so I guess it won't really be a problem for much longer though.

Thanks for looking into it.

from mikmod.

sezero avatar sezero commented on June 19, 2024

The Onlink devs are fixing the file in the next version so I guess it won't really be a problem for much longer though.

OK then, closing.

Thanks for looking into it.

You're welcome!

from mikmod.

AliceLR avatar AliceLR commented on June 19, 2024

Sorry I missed this. IMO failed sample loads for these very old formats shouldn't necessarily cause MikMod to reject the file, but I'm not familiar with Unimod. Failed sample loads are one of the most recoverable issues (just disable the sample).

from mikmod.

sezero avatar sezero commented on June 19, 2024

Hearing strange tones from broken files would be preferred?
Well, that's a choice too.

I might mess with it, but not a high priority.. Do you have a patch?

from mikmod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.