Skip to content

Commit

Permalink
cellFont, cellFs, cellGcmSys funcs added, minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekotekina committed Aug 24, 2015
1 parent c0b90d0 commit c7ee8ca
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 52 deletions.
3 changes: 2 additions & 1 deletion rpcs3/Emu/Memory/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ template<typename T> union _atomic_base
write_relaxed(sub_data, to_subtype(value));
}

// perform an atomic operation on data (callable object version, first arg is a reference to atomic type)
// perform an atomic operation on data (func is either pointer to member function or callable object with a T& first arg);
// returns the result of the callable object call or previous (old) value of the atomic variable if the return type is void
template<typename F, typename... Args, typename RT = std::result_of_t<F(T&, Args...)>> auto atomic_op(F func, Args&&... args) volatile -> decltype(atomic_op_result_t<F, RT, T>::result)
{
while (true)
Expand Down
11 changes: 6 additions & 5 deletions rpcs3/Emu/Memory/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,12 @@ namespace vm
catch (...)
{
// capture any exception possibly thrown by predicate
auto exception = std::current_exception();

// set new predicate that will throw this exception from the original thread
pred = [exception]() -> bool
pred = [exception = std::current_exception()]
{
// new predicate will throw the captured exception from the original thread
std::rethrow_exception(exception);

// dummy return value
// dummy return value, remove when std::rethrow_exception gains [[noreturn]] attribute in MSVC
return true;
};
}
Expand Down Expand Up @@ -282,6 +280,9 @@ namespace vm

void _notify_at(u32 addr, u32 size)
{
// skip notification if no waiters available
if (_mm_mfence(), !g_waiter_max) return;

std::lock_guard<std::mutex> lock(g_waiter_list_mutex);

const u32 mask = ~(size - 1);
Expand Down
37 changes: 19 additions & 18 deletions rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
m_read_buffer = true;
m_flip_status = 0;

if (m_flip_handler)
if (auto cb = m_flip_handler)
{
auto cb = m_flip_handler;
Emu.GetCallbackManager().Async([=](CPUThread& CPU)
Emu.GetCallbackManager().Async([=](CPUThread& cpu)
{
cb(static_cast<PPUThread&>(CPU), 1);
cb(static_cast<PPUThread&>(cpu), 1);
});
}

Expand Down Expand Up @@ -2311,11 +2310,19 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
case GCM_SET_USER_COMMAND:
{
const u32 cause = ARGS(0);
auto cb = m_user_handler;
Emu.GetCallbackManager().Async([=](CPUThread& CPU)

if (auto cb = m_user_handler)
{
Emu.GetCallbackManager().Async([=](CPUThread& cpu)
{
cb(static_cast<PPUThread&>(cpu), cause);
});
}
else
{
cb(static_cast<PPUThread&>(CPU), cause);
});
throw EXCEPTION("User handler not set");
}

break;
}

Expand Down Expand Up @@ -2477,9 +2484,9 @@ void RSXThread::Task()

if (auto cb = m_vblank_handler)
{
Emu.GetCallbackManager().Async([=](CPUThread& CPU)
Emu.GetCallbackManager().Async([=](CPUThread& cpu)
{
cb(static_cast<PPUThread&>(CPU), 1);
cb(static_cast<PPUThread&>(cpu), 1);
});
}
}
Expand Down Expand Up @@ -2544,10 +2551,7 @@ void RSXThread::Task()

if (cmd == 0) //nop
{
m_ctrl->get.atomic_op([](be_t<u32>& value)
{
value += 4;
});
m_ctrl->get += 4;
continue;
}

Expand All @@ -2560,10 +2564,7 @@ void RSXThread::Task()

DoCmd(cmd, cmd & 0x3ffff, args.addr(), count);

m_ctrl->get.atomic_op([count](be_t<u32>& value)
{
value += (count + 1) * 4;
});
m_ctrl->get += (count + 1) * 4;
}

OnExitThread();
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/SysCalls/Modules/cellCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ Module cellCamera("cellCamera", []()

REG_FUNC(cellCamera, cellCameraInit);
REG_FUNC(cellCamera, cellCameraEnd);
REG_FUNC(cellCamera, cellCameraOpen);
REG_FUNC(cellCamera, cellCameraOpen); // was "renamed", but exists
REG_FUNC(cellCamera, cellCameraOpenEx);
REG_FUNC(cellCamera, cellCameraClose);

Expand All @@ -323,7 +323,7 @@ Module cellCamera("cellCamera", []()
REG_FUNC(cellCamera, cellCameraGetAttribute);
REG_FUNC(cellCamera, cellCameraSetAttribute);
REG_FUNC(cellCamera, cellCameraGetBufferSize);
REG_FUNC(cellCamera, cellCameraGetBufferInfo);
REG_FUNC(cellCamera, cellCameraGetBufferInfo); // was "renamed", but exists
REG_FUNC(cellCamera, cellCameraGetBufferInfoEx);

REG_FUNC(cellCamera, cellCameraPrepExtensionUnit);
Expand Down
213 changes: 200 additions & 13 deletions rpcs3/Emu/SysCalls/Modules/cellFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ s32 cellFontGetRevisionFlags(vm::ptr<u64> revisionFlags)
return CELL_OK;
}

s32 cellFontInit(PPUThread& ppu, vm::ptr<CellFontConfig> config)
{
cellFont.Warning("cellFontInit(config=*0x%x)", config);

vm::stackvar<be_t<u64>> revisionFlags(ppu);
revisionFlags.value() = 0;
cellFontGetRevisionFlags(revisionFlags);

return cellFontInitializeWithRevision(revisionFlags.value(), config);
}

s32 cellFontEnd()
{
cellFont.Warning("cellFontEnd()");
Expand Down Expand Up @@ -632,11 +621,176 @@ s32 cellFontGetCharGlyphMetricsVertical()
return CELL_OK;
}

s32 cellFontGetRenderEffectWeight()
{
throw EXCEPTION("");
}

s32 cellFontGraphicsGetDrawType()
{
throw EXCEPTION("");
}

s32 cellFontGetKerning()
{
throw EXCEPTION("");
}

s32 cellFontGetRenderScaledKerning()
{
throw EXCEPTION("");
}

s32 cellFontGetRenderScalePixel()
{
throw EXCEPTION("");
}

s32 cellFontGlyphGetScalePixel()
{
throw EXCEPTION("");
}

s32 cellFontGlyphGetHorizontalShift()
{
throw EXCEPTION("");
}

s32 cellFontRenderCharGlyphImageHorizontal()
{
throw EXCEPTION("");
}

s32 cellFontGetEffectWeight()
{
throw EXCEPTION("");
}

s32 cellFontGetScalePixel()
{
throw EXCEPTION("");
}

s32 cellFontClearFileCache()
{
throw EXCEPTION("");
}

s32 cellFontAdjustFontScaling()
{
throw EXCEPTION("");
}

s32 cellFontSetupRenderScalePoint()
{
throw EXCEPTION("");
}

s32 cellFontGlyphGetVerticalShift()
{
throw EXCEPTION("");
}

s32 cellFontGetGlyphExpandBufferInfo()
{
throw EXCEPTION("");
}

s32 cellFontGetLibrary()
{
throw EXCEPTION("");
}

s32 cellFontVertexesGlyphRelocate()
{
throw EXCEPTION("");
}

s32 cellFontGetInitializedRevisionFlags()
{
throw EXCEPTION("");
}

s32 cellFontGetResolutionDpi()
{
throw EXCEPTION("");
}

s32 cellFontGlyphRenderImageVertical()
{
throw EXCEPTION("");
}

s32 cellFontGlyphRenderImageHorizontal()
{
throw EXCEPTION("");
}

s32 cellFontAdjustGlyphExpandBuffer()
{
throw EXCEPTION("");
}

s32 cellFontGetRenderScalePoint()
{
throw EXCEPTION("");
}

s32 cellFontGraphicsGetFontRGBA()
{
throw EXCEPTION("");
}

s32 cellFontGlyphGetOutlineVertexes()
{
throw EXCEPTION("");
}

s32 cellFontDelete()
{
throw EXCEPTION("");
}

s32 cellFontPatchWorks()
{
throw EXCEPTION("");
}

s32 cellFontGlyphRenderImage()
{
throw EXCEPTION("");
}

s32 cellFontGetBindingRenderer()
{
throw EXCEPTION("");
}

s32 cellFontGenerateCharGlyphVertical()
{
throw EXCEPTION("");
}

s32 cellFontGetRenderEffectSlant()
{
throw EXCEPTION("");
}

s32 cellFontGetScalePoint()
{
throw EXCEPTION("");
}

s32 cellFontGraphicsGetLineRGBA()
{
throw EXCEPTION("");
}


Module cellFont("cellFont", []()
{
g_font.init = false;

REG_FUNC(cellFont, cellFontInit);
REG_FUNC(cellFont, cellFontSetFontsetOpenMode);
REG_FUNC(cellFont, cellFontSetFontOpenMode);
REG_FUNC(cellFont, cellFontCreateRenderer);
Expand Down Expand Up @@ -685,5 +839,38 @@ Module cellFont("cellFont", []()
REG_FUNC(cellFont, cellFontSetResolutionDpi);
REG_FUNC(cellFont, cellFontGetCharGlyphMetricsVertical);
REG_FUNC(cellFont, cellFontUnbindRenderer);
REG_FUNC(cellFont, cellFontGetRevisionFlags);
REG_FUNC(cellFont, cellFontGetRevisionFlags);
REG_FUNC(cellFont, cellFontGetRenderEffectWeight);
REG_FUNC(cellFont, cellFontGraphicsGetDrawType);
REG_FUNC(cellFont, cellFontGetKerning);
REG_FUNC(cellFont, cellFontGetRenderScaledKerning);
REG_FUNC(cellFont, cellFontGetRenderScalePixel);
REG_FUNC(cellFont, cellFontGlyphGetScalePixel);
REG_FUNC(cellFont, cellFontGlyphGetHorizontalShift);
REG_FUNC(cellFont, cellFontRenderCharGlyphImageHorizontal);
REG_FUNC(cellFont, cellFontGetEffectWeight);
REG_FUNC(cellFont, cellFontGetScalePixel);
REG_FUNC(cellFont, cellFontClearFileCache);
REG_FUNC(cellFont, cellFontAdjustFontScaling);
REG_FUNC(cellFont, cellFontSetupRenderScalePoint);
REG_FUNC(cellFont, cellFontGlyphGetVerticalShift);
REG_FUNC(cellFont, cellFontGetGlyphExpandBufferInfo);
REG_FUNC(cellFont, cellFontGetLibrary);
REG_FUNC(cellFont, cellFontVertexesGlyphRelocate);
REG_FUNC(cellFont, cellFontGetInitializedRevisionFlags);
REG_FUNC(cellFont, cellFontGetResolutionDpi);
REG_FUNC(cellFont, cellFontGlyphRenderImageVertical);
REG_FUNC(cellFont, cellFontGlyphRenderImageHorizontal);
REG_FUNC(cellFont, cellFontAdjustGlyphExpandBuffer);
REG_FUNC(cellFont, cellFontGetRenderScalePoint);
REG_FUNC(cellFont, cellFontGraphicsGetFontRGBA);
REG_FUNC(cellFont, cellFontGlyphGetOutlineVertexes);
REG_FUNC(cellFont, cellFontDelete);
REG_FUNC(cellFont, cellFontPatchWorks);
REG_FUNC(cellFont, cellFontGlyphRenderImage);
REG_FUNC(cellFont, cellFontGetBindingRenderer);
REG_FUNC(cellFont, cellFontGenerateCharGlyphVertical);
REG_FUNC(cellFont, cellFontGetRenderEffectSlant);
REG_FUNC(cellFont, cellFontGetScalePoint);
REG_FUNC(cellFont, cellFontGraphicsGetLineRGBA);
});
Loading

0 comments on commit c7ee8ca

Please sign in to comment.