[pspplayer commit] r609 - in trunk: Noxa.Emulation.Psp.Bios.ManagedHLE/Modules Noxa.Emulation.Psp.Player/Debugger/Tools

3 views
Skip to first unread message

codesite...@google.com

unread,
Mar 31, 2008, 7:29:28 AM3/31/08
to psppla...@googlegroups.com
Author: ben.vanik
Date: Mon Mar 31 04:28:57 2008
New Revision: 609

Modified:
trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceAudio.cs
trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceMpeg.cs
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs

Log:
Log now wraps - horribly inefficient, but keeps memory use from growing unbounded
Messing with mpeg stuff - thing I'll just give in and try implementing
it all 'right'

Modified: trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceAudio.cs
==============================================================================
--- trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceAudio.cs (original)
+++ trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceAudio.cs Mon
Mar 31 04:28:57 2008
@@ -89,6 +89,9 @@
KThread thread = _kernel.ActiveThread;
thread.Delay( 16777, true );

+ if( buf == 0 )
+ return 0;
+
if( _driver == null )
return 0;


Modified: trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceMpeg.cs
==============================================================================
--- trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceMpeg.cs (original)
+++ trunk/Noxa.Emulation.Psp.Bios.ManagedHLE/Modules/sceMpeg.cs Mon Mar
31 04:28:57 2008
@@ -57,6 +57,17 @@
public const int DummyReturn = Module.NotImplementedReturn;
#endif

+ #region sceMpeg
+
+ // THIS IS NOT THE REAL STRUCTURE
+ [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+ public struct SceMpeg
+ {
+ public sceMpegRingbuffer* Ringbuffer;
+ }
+
+ #endregion
+
#region sceMpegRingbuffer

[StructLayout( LayoutKind.Sequential, Pack = 1, Size = 44 )]
@@ -188,7 +199,7 @@
public int sceMpegQueryMemSize( int unk )
{
Debug.Assert( unk == 0 );
- return 1234;
+ return 512 * 4;
}

[Stateless]
@@ -196,6 +207,14 @@
public int sceMpegCreate( int mpeg, int data, int size, int
ringbuffer, int framewidth, int unk1, int unk2 )
{
Log.WriteLine( Verbosity.Normal,
Feature.Bios, "sceMpegCreate({0:X8}, {1:X8}, {2}, {3:X8}, {4}, {5},
{6})", mpeg, data, size, ringbuffer, framewidth, unk1, unk2 );
+ byte* pmpeg = _memorySystem.Translate( ( uint )mpeg );
+ byte* pdata = _memorySystem.Translate( ( uint )data );
+ // size = size returned from sceMpegQueryMemSize
+ byte* prb = _memorySystem.Translate( ( uint )ringbuffer );
+
+ SceMpeg* sceMpeg = ( SceMpeg* )pmpeg;
+ sceMpeg->Ringbuffer = ( sceMpegRingbuffer* )prb;
+
return 0;
}

@@ -323,7 +342,26 @@
{
Debug.Assert( num != 0 );

- *( ( uint* )( _memorySystem.Translate( ( uint )num ) ) ) = 1;
+ byte* pmpeg = _memorySystem.Translate( ( uint )mpeg );
+ SceMpeg* sceMpeg = ( SceMpeg* )pmpeg;
+ byte* ptr = RingBuffer.Read(
+ _memorySystem.Translate( ( uint )sceMpeg->Ringbuffer->pData ),
+ sceMpeg->Ringbuffer->iPackets, sceMpeg->Ringbuffer->iPacketSize,
+ ref sceMpeg->Ringbuffer->iReadPackets );
+
+ uint pbuffer = *( ( uint* )_memorySystem.Translate( ( uint )buffer
) );
+ uint* ppbuffer = ( uint* )_memorySystem.Translate( pbuffer );
+ for( int n = 0; n < framewidth; n++ )
+ {
+ *( ppbuffer++ ) = ( uint )( 0xCCDDEEFF + n );
+ }
+
+ // 1 = decoded something, else 0
+ if( num != 0 )
+ {
+ uint* pnum = ( uint* )_memorySystem.Translate( ( uint )num );
+ *pnum = 1;
+ }

return 0;
}

Modified: trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs
==============================================================================
--- trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs (original)
+++ trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs Mon
Mar 31 04:28:57 2008
@@ -38,7 +38,8 @@

private readonly string[] _featureNames;

- private List<LogLine> _lines = new List<LogLine>( 20000 );
+ private const int MaximumLines = 20000;
+ private List<LogLine> _lines = new List<LogLine>( MaximumLines );
private int _firstVisibleLine;
private int _lastVisibleLine;
private int _visibleLines;
@@ -106,7 +107,11 @@
uint threadId = ( this.Debugger.DebugHost.BiosHook != null ) ?
this.Debugger.DebugHost.BiosHook.ActiveThreadID : 0;
LogLine line = new LogLine( threadId, verbosity, feature, value );
lock( _lines )
+ {
+ if( _lines.Count + 1 > MaximumLines )
+ _lines.RemoveAt( 0 );
_lines.Add( line );
+ }
if( Interlocked.Increment( ref _pendingUpdates ) > 1 )
return;
this.BeginInvoke( ( DummyDelegate )this.SafeAddLine );
@@ -399,6 +404,8 @@

for( int n = _firstVisibleLine; n <= _lastVisibleLine; n++ )
{
+ if( n >= _lines.Count )
+ break;
LogLine line = _lines[ n ];

// Label

Reply all
Reply to author
Forward
0 new messages