Exemple #1
0
        private void _retroLogCallback(RetroLogLevel level, string format,
                                       IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5, IntPtr arg6, IntPtr arg7, IntPtr arg8,
                                       IntPtr arg9, IntPtr arg10, IntPtr arg11, IntPtr arg12)
        {
            int argumentsToPush;

            try
            {
                argumentsToPush = NativeHelper.GetFormatArgumentCount(format);
            }
            catch (NotImplementedException e)
            {
                _retroLogCallbackWrapper(
                    RetroLogLevel.Warn, e.Message
                    );
                return;
            }

            if (argumentsToPush >= 12)
            {
                _retroLogCallbackWrapper(
                    RetroLogLevel.Warn, $"Too many arguments (\'{argumentsToPush.ToString()}\') supplied to retroLogCallback"
                    );
            }

            NativeHelper.Sprintf(
                out var formattedData,
                format,
                argumentsToPush >= 1 ? arg1 : IntPtr.Zero,
                argumentsToPush >= 2 ? arg2 : IntPtr.Zero,
                argumentsToPush >= 3 ? arg3 : IntPtr.Zero,
                argumentsToPush >= 4 ? arg4 : IntPtr.Zero,
                argumentsToPush >= 5 ? arg5 : IntPtr.Zero,
                argumentsToPush >= 6 ? arg6 : IntPtr.Zero,
                argumentsToPush >= 7 ? arg7 : IntPtr.Zero,
                argumentsToPush >= 8 ? arg8 : IntPtr.Zero,
                argumentsToPush >= 9 ? arg9 : IntPtr.Zero,
                argumentsToPush >= 10 ? arg10 : IntPtr.Zero,
                argumentsToPush >= 11 ? arg11 : IntPtr.Zero,
                argumentsToPush >= 12 ? arg12 : IntPtr.Zero
                );

            _retroLogCallbackWrapper(level, formattedData);
        }
Exemple #2
0
        private void _retroLogCallback(RetroLogLevel level, string formattedString)
        {
            const string message = "Core '{1}':\n---\n{0}\n---\n";

            switch (level)
            {
            case RetroLogLevel.Debug:
                Logger.Debug(message, formattedString, _coreName);
                break;

            case RetroLogLevel.Info:
                Logger.Info(message, formattedString, _coreName);
                break;

            case RetroLogLevel.Warn:
                Logger.Warn(message, formattedString, _coreName);
                break;

            case RetroLogLevel.Error:
                Logger.Error(message, formattedString, _coreName);
                break;
            }
        }