⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gprm.cc

📁 Linux下比较早的基于命令行的DVD播放器
💻 CC
字号:
//// Copyright (c) 2002 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA//------------------------------------------------------------------------------#include "GPRM.h"#include "util/Util.h"//------------------------------------------------------------------------------using dvd::vm::GPR;using dvd::vm::GPRM;//------------------------------------------------------------------------------void GPR::reset(){    isCounter = false;    setTime = 0;    setValue(0);}//------------------------------------------------------------------------------void GPR::setCounter(){    isCounter = true;    setTime = Util::currentTimeMillis();}//------------------------------------------------------------------------------void GPR::clearCounter(){    Register::setValue(Register::getValue());    isCounter = false;    setTime = 0;}//------------------------------------------------------------------------------void GPR::setValue(unsigned x){    Register::setValue(x);    if (isCounter) setTime = Util::currentTimeMillis();}//------------------------------------------------------------------------------unsigned GPR::getValue() const{    unsigned short x = Register::getValue();    if (isCounter) {        x += (Util::currentTimeMillis() - setTime + 500)/1000;    }    return x;}//------------------------------------------------------------------------------bool GPR::save(FILE* f) const{    bool ok = true;    ok = ok && Register::save(f);    ok = ok && (fwrite(&isCounter, sizeof(isCounter), 1, f)==1);    ok = ok && (fwrite(&setTime, sizeof(setTime), 1, f)==1);        return ok;}//------------------------------------------------------------------------------bool GPR::load(FILE* f){    bool ok = true;    ok = ok && Register::load(f);    ok = ok && (fread(&isCounter, sizeof(isCounter), 1, f)==1);    ok = ok && (fread(&setTime, sizeof(setTime), 1, f)==1);        return ok;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------void GPRM::reset(){    for(size_t i = 0; i<numRegisters; ++i) {        registers[i].reset();    }}//------------------------------------------------------------------------------bool GPRM::save(FILE* f) const{    bool ok = true;    for(size_t i = 0; i<numRegisters && ok; ++i) {        ok = registers[i].save(f);    }    return ok;}//------------------------------------------------------------------------------bool GPRM::load(FILE* f){    bool ok = true;    for(size_t i = 0; i<numRegisters && ok; ++i) {        ok = registers[i].load(f);    }    return ok;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -