diff --git a/lib/LtgLoader.js b/lib/LtgLoader.js index ecda050..0cea968 100644 --- a/lib/LtgLoader.js +++ b/lib/LtgLoader.js @@ -48,12 +48,12 @@ */ ltjs.LtgLoader = Class( 'LtgLoader', { - /** various data segment byte offsets and ranges **/ + /** various data segment byte offsets and lengths **/ 'private const _POS_NAME': [ 0, 40 ], 'private const _POS_AUTHOR': [ 40, 30 ], - 'private const _POS_DESC': [ 70, 315 ], - 'private const _POS_ID': [ 315, 320 ], - 'private const _POS_MOFF': [ 320, 324 ], + 'private const _POS_DESC': [ 70, 245 ], + 'private const _POS_ID': [ 315, 5 ], + 'private const _POS_MOFF': [ 320, 4 ], /** * Beginning of game bitmap (one byte past the header) @@ -103,15 +103,18 @@ ltjs.LtgLoader = Class( 'LtgLoader', 'private _getDataSegment': function( ltg_data, sgmt, stripnull ) { // strip null bytes by default - stripnull = ( stripnull === undefined ) ? true : false; + stripnull = ( stripnull === undefined ) ? true : !!stripnull; if ( typeof sgmt === 'string' ) { sgmt = this.__self.$( sgmt ); } - return String.prototype.substr.apply( ltg_data, sgmt ) - .split( '\x00' )[ 0 ]; + var data = String.prototype.substr.apply( ltg_data, sgmt ); + + return ( stripnull ) + ? data.split( '\x00' )[ 0 ] + : data; },