Files
RomhackPlaza/app/Http/Controllers/ToolsController.php
2026-06-16 16:21:43 +02:00

60 lines
1.3 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Entry;
use App\Models\EntryFile;
use App\Services\FileServersService;
use Illuminate\Http\Request;
class ToolsController extends Controller
{
public function patcher()
{
return view('tools.patcher');
}
public function directPatch( Request $request, int $entryId, EntryFile $file )
{
if( $file->entry_id != $entryId ) {
abort(404);
}
$service = app(FileServersService::class);
$patches = [
'file' => $service->getDownloadFileUrl( $file ),
'name' => $file->entry->title,
'outputName' => $file->filename
];
return view('tools.patcher', compact('patches'));
}
public function play( Request $request, int $entryId, EntryFile $file )
{
if( $file->entry_id != $entryId ) {
abort(404);
}
$service = app(FileServersService::class);
$patches = [
'file' => $service->getDownloadFileUrl( $file ),
'name' => $file->entry->title,
'outputName' => $file->filename
];
$emuConfig = [
'core' => $file->playOnlineSetting?->core,
'threads' => $file->playOnlineSetting?->threads,
];
return view('tools.play', compact('patches', 'emuConfig'));
}
}